ReactOS  0.4.14-dev-599-g2d4d3f5
clocks.c File Reference
#include "precomp.h"
#include <debug.h>
Include dependency graph for clocks.c:

Go to the source code of this file.

Classes

struct  KSIDEFAULTCLOCK
 
struct  KSICLOCK
 

Macros

#define NDEBUG
 

Typedefs

typedef struct KSIDEFAULTCLOCKPKSIDEFAULTCLOCK
 
typedef struct KSICLOCKPKSICLOCK
 

Functions

NTSTATUS NTAPI ClockPropertyTime (IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
 
NTSTATUS NTAPI ClockPropertyPhysicalTime (IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
 
NTSTATUS NTAPI ClockPropertyCorrelatedTime (IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
 
NTSTATUS NTAPI ClockPropertyCorrelatedPhysicalTime (IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
 
NTSTATUS NTAPI ClockPropertyResolution (IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
 
NTSTATUS NTAPI ClockPropertyState (IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
 
NTSTATUS NTAPI ClockPropertyFunctionTable (IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
 
 DEFINE_KSPROPERTY_CLOCKSET (ClockPropertyTable, ClockPropertyTime, ClockPropertyPhysicalTime, ClockPropertyCorrelatedTime, ClockPropertyCorrelatedPhysicalTime, ClockPropertyResolution, ClockPropertyState, ClockPropertyFunctionTable)
 
LONGLONG FASTCALL ClockGetPhysicalTime (IN PFILE_OBJECT FileObject)
 
LONGLONG FASTCALL ClockGetCorrelatedTime (IN PFILE_OBJECT FileObject, OUT PLONGLONG SystemTime)
 
LONGLONG FASTCALL ClockGetTime (IN PFILE_OBJECT FileObject)
 
LONGLONG FASTCALL ClockGetCorrelatedPhysicalTime (IN PFILE_OBJECT FileObject, OUT PLONGLONG SystemTime)
 
KSDDKAPI NTSTATUS NTAPI KsCreateClock (IN HANDLE ConnectionHandle, IN PKSCLOCK_CREATE ClockCreate, OUT PHANDLE ClockHandle)
 
KSDDKAPI NTSTATUS NTAPI KsValidateClockCreateRequest (IN PIRP Irp, OUT PKSCLOCK_CREATE *OutClockCreate)
 
NTSTATUS NTAPI IKsClock_DispatchDeviceIoControl (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI IKsClock_DispatchClose (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
KSDDKAPI NTSTATUS NTAPI KsCreateDefaultClock (IN PIRP Irp, IN PKSDEFAULTCLOCK DefaultClock)
 
KSDDKAPI NTSTATUS NTAPI KsAllocateDefaultClock (OUT PKSDEFAULTCLOCK *DefaultClock)
 
KSDDKAPI NTSTATUS NTAPI KsAllocateDefaultClockEx (OUT PKSDEFAULTCLOCK *DefaultClock, IN PVOID Context OPTIONAL, IN PFNKSSETTIMER SetTimer OPTIONAL, IN PFNKSCANCELTIMER CancelTimer OPTIONAL, IN PFNKSCORRELATEDTIME CorrelatedTime OPTIONAL, IN const KSRESOLUTION *Resolution OPTIONAL, IN ULONG Flags)
 
KSDDKAPI VOID NTAPI KsFreeDefaultClock (IN PKSDEFAULTCLOCK DefaultClock)
 
KSDDKAPI KSSTATE NTAPI KsGetDefaultClockState (IN PKSDEFAULTCLOCK DefaultClock)
 
KSDDKAPI VOID NTAPI KsSetDefaultClockState (IN PKSDEFAULTCLOCK DefaultClock, IN KSSTATE State)
 
KSDDKAPI LONGLONG NTAPI KsGetDefaultClockTime (IN PKSDEFAULTCLOCK DefaultClock)
 
KSDDKAPI VOID NTAPI KsSetDefaultClockTime (IN PKSDEFAULTCLOCK DefaultClock, IN LONGLONG Time)
 

Variables

KSPROPERTY_SET ClockPropertySet []
 
static KSDISPATCH_TABLE DispatchTable
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file clocks.c.

Typedef Documentation

◆ PKSICLOCK

◆ PKSIDEFAULTCLOCK

Function Documentation

◆ ClockGetCorrelatedPhysicalTime()

LONGLONG FASTCALL ClockGetCorrelatedPhysicalTime ( IN PFILE_OBJECT  FileObject,
OUT PLONGLONG  SystemTime 
)

Definition at line 91 of file clocks.c.

94 {
96  return 0;
97 }
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by ClockPropertyCorrelatedPhysicalTime(), and ClockPropertyFunctionTable().

◆ ClockGetCorrelatedTime()

LONGLONG FASTCALL ClockGetCorrelatedTime ( IN PFILE_OBJECT  FileObject,
OUT PLONGLONG  SystemTime 
)

Definition at line 72 of file clocks.c.

75 {
77  return 0;
78 }
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by ClockPropertyCorrelatedTime(), and ClockPropertyFunctionTable().

◆ ClockGetPhysicalTime()

LONGLONG FASTCALL ClockGetPhysicalTime ( IN PFILE_OBJECT  FileObject)

Definition at line 63 of file clocks.c.

65 {
67  return 0;
68 }
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by ClockPropertyFunctionTable(), and ClockPropertyPhysicalTime().

◆ ClockGetTime()

LONGLONG FASTCALL ClockGetTime ( IN PFILE_OBJECT  FileObject)

Definition at line 82 of file clocks.c.

84 {
86  return 0;
87 }
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by ClockPropertyFunctionTable(), and ClockPropertyTime().

◆ ClockPropertyCorrelatedPhysicalTime()

NTSTATUS NTAPI ClockPropertyCorrelatedPhysicalTime ( IN PIRP  Irp,
IN PKSIDENTIFIER  Request,
IN OUT PVOID  Data 
)

Definition at line 155 of file clocks.c.

159 {
162 
163  DPRINT("ClockPropertyCorrelatedPhysicalTime\n");
164 
165  Time->Time = ClockGetCorrelatedPhysicalTime(IoStack->FileObject, &Time->SystemTime);
166 
167  Irp->IoStatus.Information = sizeof(KSCORRELATED_TIME);
168  return STATUS_SUCCESS;
169 }
_In_ PIRP Irp
Definition: csq.h:116
void DPRINT(...)
Definition: polytest.cpp:61
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
struct KSCORRELATED_TIME * PKSCORRELATED_TIME
LONGLONG FASTCALL ClockGetCorrelatedPhysicalTime(IN PFILE_OBJECT FileObject, OUT PLONGLONG SystemTime)
Definition: clocks.c:91
return STATUS_SUCCESS
Definition: btrfs.c:2938
static PLARGE_INTEGER Time
Definition: time.c:105

◆ ClockPropertyCorrelatedTime()

NTSTATUS NTAPI ClockPropertyCorrelatedTime ( IN PIRP  Irp,
IN PKSIDENTIFIER  Request,
IN OUT PVOID  Data 
)

Definition at line 137 of file clocks.c.

141 {
144 
145  DPRINT("ClockPropertyCorrelatedTime\n");
146 
147  Time->Time = ClockGetCorrelatedTime(IoStack->FileObject, &Time->SystemTime);
148 
149  Irp->IoStatus.Information = sizeof(KSCORRELATED_TIME);
150  return STATUS_SUCCESS;
151 }
_In_ PIRP Irp
Definition: csq.h:116
void DPRINT(...)
Definition: polytest.cpp:61
LONGLONG FASTCALL ClockGetCorrelatedTime(IN PFILE_OBJECT FileObject, OUT PLONGLONG SystemTime)
Definition: clocks.c:72
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
struct KSCORRELATED_TIME * PKSCORRELATED_TIME
return STATUS_SUCCESS
Definition: btrfs.c:2938
static PLARGE_INTEGER Time
Definition: time.c:105

◆ ClockPropertyFunctionTable()

NTSTATUS NTAPI ClockPropertyFunctionTable ( IN PIRP  Irp,
IN PKSIDENTIFIER  Request,
IN OUT PVOID  Data 
)

Definition at line 238 of file clocks.c.

242 {
243  PKSCLOCK_FUNCTIONTABLE Table = (PKSCLOCK_FUNCTIONTABLE)Data;
244 
245  DPRINT("ClockPropertyFunctionTable\n");
246 
247  Table->GetCorrelatedPhysicalTime = ClockGetCorrelatedPhysicalTime;
248  Table->GetCorrelatedTime = ClockGetCorrelatedTime;
249  Table->GetPhysicalTime = ClockGetPhysicalTime;
250  Table->GetTime = ClockGetTime;
251 
252  return STATUS_SUCCESS;
253 }
ASMGENDATA Table[]
Definition: genincdata.c:61
LONGLONG FASTCALL ClockGetTime(IN PFILE_OBJECT FileObject)
Definition: clocks.c:82
void DPRINT(...)
Definition: polytest.cpp:61
LONGLONG FASTCALL ClockGetCorrelatedTime(IN PFILE_OBJECT FileObject, OUT PLONGLONG SystemTime)
Definition: clocks.c:72
LONGLONG FASTCALL ClockGetCorrelatedPhysicalTime(IN PFILE_OBJECT FileObject, OUT PLONGLONG SystemTime)
Definition: clocks.c:91
LONGLONG FASTCALL ClockGetPhysicalTime(IN PFILE_OBJECT FileObject)
Definition: clocks.c:63
return STATUS_SUCCESS
Definition: btrfs.c:2938

◆ ClockPropertyPhysicalTime()

NTSTATUS NTAPI ClockPropertyPhysicalTime ( IN PIRP  Irp,
IN PKSIDENTIFIER  Request,
IN OUT PVOID  Data 
)

Definition at line 119 of file clocks.c.

123 {
126 
127  DPRINT("ClockPropertyPhysicalTime\n");
128 
129  *Time = ClockGetPhysicalTime(IoStack->FileObject);
130 
131  Irp->IoStatus.Information = sizeof(LONGLONG);
132  return STATUS_SUCCESS;
133 }
_In_ PIRP Irp
Definition: csq.h:116
__GNU_EXTENSION typedef __int64 * PLONGLONG
Definition: ntbasedef.h:389
void DPRINT(...)
Definition: polytest.cpp:61
int64_t LONGLONG
Definition: typedefs.h:66
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
LONGLONG FASTCALL ClockGetPhysicalTime(IN PFILE_OBJECT FileObject)
Definition: clocks.c:63
return STATUS_SUCCESS
Definition: btrfs.c:2938
static PLARGE_INTEGER Time
Definition: time.c:105

◆ ClockPropertyResolution()

NTSTATUS NTAPI ClockPropertyResolution ( IN PIRP  Irp,
IN PKSIDENTIFIER  Request,
IN OUT PVOID  Data 
)

Definition at line 173 of file clocks.c.

177 {
179  PKSIOBJECT_HEADER ObjectHeader;
180  PIO_STACK_LOCATION IoStack;
182 
183  DPRINT("ClockPropertyResolution\n");
184 
185  /* get stack location */
187 
188  /* get the object header */
189  ObjectHeader = (PKSIOBJECT_HEADER)IoStack->FileObject->FsContext2;
190 
191  /* sanity check */
192  ASSERT(ObjectHeader);
193 
194  /* locate ks pin implementation from KSPIN offset */
195  Clock = (PKSICLOCK)ObjectHeader->ObjectType;
196 
197  Resolution->Error = Clock->DefaultClock->Error;
198  Resolution->Granularity = Clock->DefaultClock->Granularity;
199 
200  Irp->IoStatus.Information = sizeof(KSRESOLUTION);
201  return STATUS_SUCCESS;
202 }
struct KSRESOLUTION * PKSRESOLUTION
struct KSICLOCK * PKSICLOCK
_In_ PIRP Irp
Definition: csq.h:116
struct KSIOBJECT_HEADER * PKSIOBJECT_HEADER
void DPRINT(...)
Definition: polytest.cpp:61
PVOID ObjectType
Definition: kstypes.h:30
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
static BYTE Resolution
Definition: mouse.c:35
int Clock
Definition: mmuobject.c:63
return STATUS_SUCCESS
Definition: btrfs.c:2938

◆ ClockPropertyState()

NTSTATUS NTAPI ClockPropertyState ( IN PIRP  Irp,
IN PKSIDENTIFIER  Request,
IN OUT PVOID  Data 
)

Definition at line 206 of file clocks.c.

210 {
212  PKSIOBJECT_HEADER ObjectHeader;
214  PIO_STACK_LOCATION IoStack;
215 
216  DPRINT("ClockPropertyState\n");
217 
218  /* get stack location */
220 
221  /* get the object header */
222  ObjectHeader = (PKSIOBJECT_HEADER)IoStack->FileObject->FsContext2;
223 
224  /* sanity check */
225  ASSERT(ObjectHeader);
226 
227  /* locate ks pin implementation from KSPIN offset */
228  Clock = (PKSICLOCK)ObjectHeader->ObjectType;
229 
230  *State = Clock->DefaultClock->State;
231  Irp->IoStatus.Information = sizeof(KSSTATE);
232 
233  return STATUS_SUCCESS;
234 }
struct KSICLOCK * PKSICLOCK
_In_ PIRP Irp
Definition: csq.h:116
struct KSIOBJECT_HEADER * PKSIOBJECT_HEADER
enum KSSTATE * PKSSTATE
void DPRINT(...)
Definition: polytest.cpp:61
PVOID ObjectType
Definition: kstypes.h:30
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
KSSTATE
Definition: ks.h:1214
int Clock
Definition: mmuobject.c:63
return STATUS_SUCCESS
Definition: btrfs.c:2938

◆ ClockPropertyTime()

NTSTATUS NTAPI ClockPropertyTime ( IN PIRP  Irp,
IN PKSIDENTIFIER  Request,
IN OUT PVOID  Data 
)

Definition at line 101 of file clocks.c.

105 {
108 
109  DPRINT("ClockPropertyTime\n");
110 
111  *Time = ClockGetTime(IoStack->FileObject);
112 
113  Irp->IoStatus.Information = sizeof(LONGLONG);
114  return STATUS_SUCCESS;
115 }
_In_ PIRP Irp
Definition: csq.h:116
LONGLONG FASTCALL ClockGetTime(IN PFILE_OBJECT FileObject)
Definition: clocks.c:82
__GNU_EXTENSION typedef __int64 * PLONGLONG
Definition: ntbasedef.h:389
void DPRINT(...)
Definition: polytest.cpp:61
int64_t LONGLONG
Definition: typedefs.h:66
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
return STATUS_SUCCESS
Definition: btrfs.c:2938
static PLARGE_INTEGER Time
Definition: time.c:105

◆ DEFINE_KSPROPERTY_CLOCKSET()

◆ IKsClock_DispatchClose()

NTSTATUS NTAPI IKsClock_DispatchClose ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 351 of file clocks.c.

354 {
356 
357  Irp->IoStatus.Status = STATUS_SUCCESS;
359 
360  return STATUS_SUCCESS;
361 }
_In_ PIRP Irp
Definition: csq.h:116
NTSTATUS NTAPI CompleteRequest(IN PIRP Irp, IN NTSTATUS Status, IN ULONG_PTR Information)
Definition: dispatch.c:19
#define IO_NO_INCREMENT
Definition: iotypes.h:566
#define UNIMPLEMENTED
Definition: debug.h:114
return STATUS_SUCCESS
Definition: btrfs.c:2938

◆ IKsClock_DispatchDeviceIoControl()

NTSTATUS NTAPI IKsClock_DispatchDeviceIoControl ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 312 of file clocks.c.

315 {
316  PIO_STACK_LOCATION IoStack;
320 
321  DPRINT("IKsClock_DispatchDeviceIoControl\n");
322 
323  /* get current io stack */
325 
326  /* FIXME support events */
327  ASSERT(IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_PROPERTY);
328 
329  /* sanity check */
330  ASSERT(IoStack->Parameters.DeviceIoControl.InputBufferLength >= sizeof(KSPROPERTY));
331 
332  /* call property handler */
334 
335  /* get property from input buffer */
336  Property = (PKSPROPERTY)IoStack->Parameters.DeviceIoControl.Type3InputBuffer;
337 
339  DPRINT("IKsClock_DispatchDeviceIoControl property Set |%S| Id %u Flags %x Status %lx ResultLength %lu\n", GuidString.Buffer, Property->Id, Property->Flags, Status, Irp->IoStatus.Information);
341 
342 
343  Irp->IoStatus.Status = STATUS_SUCCESS;
345 
346  return STATUS_SUCCESS;
347 }
static PWSTR GuidString
Definition: apphelp.c:91
#define IOCTL_KS_PROPERTY
Definition: ks.h:127
KSPROPERTY_SET ClockPropertySet[]
Definition: clocks.c:50
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
KSDDKAPI NTSTATUS NTAPI KsPropertyHandler(IN PIRP Irp, IN ULONG PropertySetsCount, IN const KSPROPERTY_SET *PropertySet)
Definition: property.c:358
void DPRINT(...)
Definition: polytest.cpp:61
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
NTSTATUS NTAPI CompleteRequest(IN PIRP Irp, IN NTSTATUS Status, IN ULONG_PTR Information)
Definition: dispatch.c:19
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
NTSYSAPI NTSTATUS WINAPI RtlStringFromGUID(REFGUID, PUNICODE_STRING)
Status
Definition: gdiplustypes.h:24
_In_ DWORD Property
Definition: setupapi.h:1545
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
#define IO_NO_INCREMENT
Definition: iotypes.h:566
struct KSIDENTIFIER * PKSPROPERTY
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
return STATUS_SUCCESS
Definition: btrfs.c:2938

◆ KsAllocateDefaultClock()

KSDDKAPI NTSTATUS NTAPI KsAllocateDefaultClock ( OUT PKSDEFAULTCLOCK DefaultClock)

Definition at line 434 of file clocks.c.

436 {
437  return KsAllocateDefaultClockEx(DefaultClock, NULL, NULL, NULL, NULL, NULL, 0);
438 }
KSDDKAPI NTSTATUS NTAPI KsAllocateDefaultClockEx(OUT PKSDEFAULTCLOCK *DefaultClock, IN PVOID Context OPTIONAL, IN PFNKSSETTIMER SetTimer OPTIONAL, IN PFNKSCANCELTIMER CancelTimer OPTIONAL, IN PFNKSCORRELATEDTIME CorrelatedTime OPTIONAL, IN const KSRESOLUTION *Resolution OPTIONAL, IN ULONG Flags)
Definition: clocks.c:446
smooth NULL
Definition: ftsmooth.c:416

◆ KsAllocateDefaultClockEx()

KSDDKAPI NTSTATUS NTAPI KsAllocateDefaultClockEx ( OUT PKSDEFAULTCLOCK DefaultClock,
IN PVOID Context  OPTIONAL,
IN PFNKSSETTIMER SetTimer  OPTIONAL,
IN PFNKSCANCELTIMER CancelTimer  OPTIONAL,
IN PFNKSCORRELATEDTIME CorrelatedTime  OPTIONAL,
IN const KSRESOLUTION *Resolution  OPTIONAL,
IN ULONG  Flags 
)

Definition at line 446 of file clocks.c.

454 {
456 
457  if (!DefaultClock)
459 
460  /* allocate default clock */
462  if (!Clock)
464 
465  /* initialize default clock */
466  KeInitializeSpinLock(&Clock->TimeLock);
467  KeInitializeTimer(&Clock->Timer);
468  Clock->ReferenceCount = 1;
469  Clock->Context = Context;
470  Clock->SetTimer = SetTimer;
471  Clock->CancelTimer = CancelTimer;
472  Clock->CorrelatedTime = CorrelatedTime;
473  Clock->Flags = Flags;
474 
475  if (Resolution)
476  {
477  if (SetTimer)
478  {
479  Clock->Error = Resolution->Error;
480  }
481 
482  if (CorrelatedTime)
483  {
484  Clock->Granularity = Resolution->Granularity;
485  }
486  }
487 
488  *DefaultClock = (PKSDEFAULTCLOCK)Clock;
489  return STATUS_SUCCESS;
490 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:30
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:251
VOID NTAPI KeInitializeTimer(OUT PKTIMER Timer)
Definition: timerobj.c:233
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define STATUS_INVALID_PARAMETER_1
Definition: ntstatus.h:461
PVOID PKSDEFAULTCLOCK
Definition: ks.h:1854
static BYTE Resolution
Definition: mouse.c:35
struct tagContext Context
Definition: acpixf.h:1030
int Clock
Definition: mmuobject.c:63
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by IKsPin_DispatchCreateClock(), and KsAllocateDefaultClock().

◆ KsCreateClock()

KSDDKAPI NTSTATUS NTAPI KsCreateClock ( IN HANDLE  ConnectionHandle,
IN PKSCLOCK_CREATE  ClockCreate,
OUT PHANDLE  ClockHandle 
)

Definition at line 260 of file clocks.c.

264 {
267  ClockCreate,
268  sizeof(KSCLOCK_CREATE),
269  GENERIC_READ,
270  ClockHandle);
271 }
NTSTATUS NTAPI KspCreateObjectType(IN HANDLE ParentHandle, IN LPWSTR ObjectType, PVOID CreateParameters, UINT CreateParametersSize, IN ACCESS_MASK DesiredAccess, OUT PHANDLE NodeHandle)
Definition: topology.c:16
_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

◆ KsCreateDefaultClock()

KSDDKAPI NTSTATUS NTAPI KsCreateDefaultClock ( IN PIRP  Irp,
IN PKSDEFAULTCLOCK  DefaultClock 
)

Definition at line 383 of file clocks.c.

386 {
390 
392  if (!NT_SUCCESS(Status))
393  return Status;
394 
395  /* let's allocate the clock struct */
397  if (!Clock)
398  {
401  }
402 
403  /* now allocate the object header */
404  Status = KsAllocateObjectHeader((PVOID*)&Clock->ObjectHeader, 0, NULL, Irp, &DispatchTable);
405 
406  /* did it work */
407  if (!NT_SUCCESS(Status))
408  {
409  /* failed */
411  FreeItem(Clock);
412  return Status;
413  }
414 
415  /* initialize clock */
416  /* FIXME IKsClock */
417  Clock->ObjectHeader->ObjectType = (PVOID)Clock;
418  Clock->ref = 1;
419  Clock->ClockCreate = ClockCreate;
420  Clock->DefaultClock = (PKSIDEFAULTCLOCK)DefaultClock;
421 
422  /* increment reference count */
423  InterlockedIncrement(&Clock->DefaultClock->ReferenceCount);
424 
425  return Status;
426 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
struct KSIDEFAULTCLOCK * PKSIDEFAULTCLOCK
_In_ PIRP Irp
Definition: csq.h:116
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:30
LONG NTSTATUS
Definition: precomp.h:26
KSDDKAPI NTSTATUS NTAPI KsValidateClockCreateRequest(IN PIRP Irp, OUT PKSCLOCK_CREATE *OutClockCreate)
Definition: clocks.c:279
VOID FreeItem(IN PVOID Item)
Definition: misc.c:43
static KSDISPATCH_TABLE DispatchTable
Definition: clocks.c:363
smooth NULL
Definition: ftsmooth.c:416
void * PVOID
Definition: retypes.h:9
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
#define InterlockedIncrement
Definition: armddk.h:53
_In_ PKSCLOCK_CREATE ClockCreate
Definition: ks.h:4527
KSDDKAPI NTSTATUS NTAPI KsAllocateObjectHeader(OUT KSOBJECT_HEADER *Header, IN ULONG ItemsCount, IN PKSOBJECT_CREATE_ITEM ItemsList OPTIONAL, IN PIRP Irp, IN KSDISPATCH_TABLE *Table)
Definition: api.c:610
int Clock
Definition: mmuobject.c:63

Referenced by IKsPin_DispatchCreateClock().

◆ KsFreeDefaultClock()

KSDDKAPI VOID NTAPI KsFreeDefaultClock ( IN PKSDEFAULTCLOCK  DefaultClock)

Definition at line 498 of file clocks.c.

500 {
501  PKSIDEFAULTCLOCK Clock = (PKSIDEFAULTCLOCK)DefaultClock;
502 
503  InterlockedDecrement(&Clock->ReferenceCount);
504 
505  if (Clock->ReferenceCount == 0)
506  {
507  /* free default clock */
508  FreeItem(Clock);
509  }
510 }
struct KSIDEFAULTCLOCK * PKSIDEFAULTCLOCK
VOID FreeItem(IN PVOID Item)
Definition: misc.c:43
#define InterlockedDecrement
Definition: armddk.h:52
int Clock
Definition: mmuobject.c:63

◆ KsGetDefaultClockState()

KSDDKAPI KSSTATE NTAPI KsGetDefaultClockState ( IN PKSDEFAULTCLOCK  DefaultClock)

Definition at line 518 of file clocks.c.

520 {
521  PKSIDEFAULTCLOCK Clock = (PKSIDEFAULTCLOCK)DefaultClock;
522  return Clock->State;
523 }
struct KSIDEFAULTCLOCK * PKSIDEFAULTCLOCK
int Clock
Definition: mmuobject.c:63

◆ KsGetDefaultClockTime()

KSDDKAPI LONGLONG NTAPI KsGetDefaultClockTime ( IN PKSDEFAULTCLOCK  DefaultClock)

Definition at line 551 of file clocks.c.

553 {
554  LONGLONG Time = 0LL;
555  PKSIDEFAULTCLOCK Clock = (PKSIDEFAULTCLOCK)DefaultClock;
556 
557  Time = ExInterlockedCompareExchange64(&Clock->Time, &Time, &Time, &Clock->TimeLock);
558 
559  return Time;
560 }
#define LL
Definition: tui.h:85
struct KSIDEFAULTCLOCK * PKSIDEFAULTCLOCK
NTKERNELAPI LONGLONG FASTCALL ExInterlockedCompareExchange64(IN OUT PLONGLONG Destination, IN PLONGLONG Exchange, IN PLONGLONG Comparand, IN PKSPIN_LOCK Lock)
Definition: interlocked.c:113
int64_t LONGLONG
Definition: typedefs.h:66
int Clock
Definition: mmuobject.c:63
static PLARGE_INTEGER Time
Definition: time.c:105

◆ KsSetDefaultClockState()

KSDDKAPI VOID NTAPI KsSetDefaultClockState ( IN PKSDEFAULTCLOCK  DefaultClock,
IN KSSTATE  State 
)

Definition at line 531 of file clocks.c.

534 {
535  PKSIDEFAULTCLOCK Clock = (PKSIDEFAULTCLOCK)DefaultClock;
536 
537  if (State != Clock->State)
538  {
539  /* FIXME set time etc */
540  Clock->State = State;
541  }
542 
543 }
struct KSIDEFAULTCLOCK * PKSIDEFAULTCLOCK
enum State_ State
Definition: pofuncs.h:54
int Clock
Definition: mmuobject.c:63

◆ KsSetDefaultClockTime()

KSDDKAPI VOID NTAPI KsSetDefaultClockTime ( IN PKSDEFAULTCLOCK  DefaultClock,
IN LONGLONG  Time 
)

Definition at line 568 of file clocks.c.

571 {
572  PKSIDEFAULTCLOCK Clock = (PKSIDEFAULTCLOCK)DefaultClock;
573 
574  /* set the time safely */
575  ExInterlockedCompareExchange64(&Clock->Time, &Time, &Clock->Time, &Clock->TimeLock);
576 }
struct KSIDEFAULTCLOCK * PKSIDEFAULTCLOCK
NTKERNELAPI LONGLONG FASTCALL ExInterlockedCompareExchange64(IN OUT PLONGLONG Destination, IN PLONGLONG Exchange, IN PLONGLONG Comparand, IN PKSPIN_LOCK Lock)
Definition: interlocked.c:113
int Clock
Definition: mmuobject.c:63
static PLARGE_INTEGER Time
Definition: time.c:105

◆ KsValidateClockCreateRequest()

KSDDKAPI NTSTATUS NTAPI KsValidateClockCreateRequest ( IN PIRP  Irp,
OUT PKSCLOCK_CREATE OutClockCreate 
)

Definition at line 279 of file clocks.c.

282 {
285  ULONG Size;
286 
287  /* minimum request size */
288  Size = sizeof(KSCLOCK_CREATE);
289 
290  /* copy create request */
293  &Size,
294  (PVOID*)&ClockCreate);
295 
296  if (!NT_SUCCESS(Status))
297  return Status;
298 
299  if (ClockCreate->CreateFlags != 0)
300  {
301  /* flags must be zero */
304  }
305 
306  *OutClockCreate = ClockCreate;
307  return STATUS_SUCCESS;
308 }
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS KspCopyCreateRequest(IN PIRP Irp, IN LPWSTR ObjectClass, IN OUT PULONG Size, OUT PVOID *Result)
Definition: misc.c:101
#define KSSTRING_Clock
Definition: ks.h:49
VOID FreeItem(IN PVOID Item)
Definition: misc.c:43
ULONG CreateFlags
Definition: ks.h:1857
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
Status
Definition: gdiplustypes.h:24
_In_ PKSCLOCK_CREATE ClockCreate
Definition: ks.h:4527
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by KsCreateDefaultClock().

Variable Documentation

◆ ClockPropertySet

KSPROPERTY_SET ClockPropertySet[]
Initial value:
=
{
{
sizeof(ClockPropertyTable) / sizeof(KSPROPERTY_ITEM),
(const KSPROPERTY_ITEM*)&ClockPropertyTable,
0,
}
}
const GUID KSPROPSETID_Clock
Definition: pin.c:115
smooth NULL
Definition: ftsmooth.c:416

Definition at line 50 of file clocks.c.

Referenced by IKsClock_DispatchDeviceIoControl().

◆ DispatchTable

KSDISPATCH_TABLE DispatchTable
static
Initial value:
=
{
}
KSDDKAPI NTSTATUS NTAPI KsDispatchSetSecurity(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:67
KSDDKAPI NTSTATUS NTAPI KsDispatchQuerySecurity(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:22
NTSTATUS NTAPI IKsClock_DispatchDeviceIoControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: clocks.c:312
KSDDKAPI BOOLEAN NTAPI KsDispatchFastIoDeviceControlFailure(IN PFILE_OBJECT FileObject, IN BOOLEAN Wait, IN PVOID InputBuffer OPTIONAL, IN ULONG InputBufferLength, OUT PVOID OutputBuffer OPTIONAL, IN ULONG OutputBufferLength, IN ULONG IoControlCode, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: irp.c:1218
KSDDKAPI NTSTATUS NTAPI KsDispatchInvalidDeviceRequest(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1156
NTSTATUS NTAPI IKsClock_DispatchClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: clocks.c:351
KSDDKAPI BOOLEAN NTAPI KsDispatchFastReadFailure(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, OUT PVOID Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: irp.c:1238

Definition at line 363 of file clocks.c.

Referenced by KsCreateDefaultClock().