ReactOS 0.4.17-dev-1037-g720d112
classlib.cpp File Reference
#include "ucx01000.h"
#include <debug.h>
Include dependency graph for classlib.cpp:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

static ULONG NTAPI UcxTableEntriesForMinor (_In_ ULONG Minor)
 
 _IRQL_requires_ (PASSIVE_LEVEL) NTSTATUS NTAPI UcxOnClassLoad(VOID)
 Sends a synchronous IOCTL to the specified device object.
 
 PAGED_CODE ()
 
 if (ClientGlobals==NULL) return STATUS_INVALID_PARAMETER
 
 if (ClassBindInfo->Version.Major !=UCX_CLASS_MAJOR_VERSION||Minor > UCX_CLASS_MINOR_VERSION)
 
 if (ClassBindInfo->FunctionTableCount !=UcxTableEntriesForMinor(Minor))
 
 if (Globals==NULL) return STATUS_INSUFFICIENT_RESOURCES
 
 RtlCopyMemory (ClassBindInfo->FunctionTable, UcxExportTable, ClassBindInfo->FunctionTableCount *sizeof(UcxExportTable[0]))
 
 UNREFERENCED_PARAMETER (ComponentGlobals)
 

Variables

static PFN_UCXFUNC UcxExportTable [UcxFunctionTableNumEntries]
 
WDF_CLASS_LIBRARY_INFO UcxClassLibraryInfo
 
_Out_ PWDF_COMPONENT_GLOBALS * ComponentGlobals
 
PUCX_DRIVER_GLOBALS Globals = (PUCX_DRIVER_GLOBALS)ExAllocatePoolZero(NonPagedPool, sizeof(*Globals), UCX_POOL_TAG)
 
ULONG Minor = ClassBindInfo->Version.Minor
 
 ClientGlobals = (PUCX_DRIVER_GLOBALS *)ClassBindInfo->ClassBindInfo
 
Globals Size = sizeof(*Globals)
 
Globals WdfDriverGlobals = (PWDF_DRIVER_GLOBALS)ComponentGlobals
 
return STATUS_SUCCESS
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 10 of file classlib.cpp.

Function Documentation

◆ _IRQL_requires_()

_IRQL_requires_ ( PASSIVE_LEVEL  )

Sends a synchronous IOCTL to the specified device object.

Parameters
[in]IoControlCodeThe IOCTL to send to the device.
[in]DeviceObjectPointer to the device object that will handle the IOCTL.
[in]InputBufferOptional pointer to a buffer containing input data for the IOCTL. When specified, the buffer should be at least of InputBufferLength size.
[in]InputBufferLengthSize in bytes, of the buffer pointed by InputBuffer.
[out]OutputBufferOptional pointer to a buffer that will receive output data from the IOCTL. When specified, the buffer should be at least of OutputBufferLength size.
[in]OutputBufferLengthSize in bytes, of the buffer pointed by OutputBuffer.
[in]FileObjectOptional pointer to a file object that may be necessary for the IOCTL.
Returns
An NTSTATUS code indicating success or failure of this function.
Note
Must be called at PASSIVE_LEVEL with all APCs enabled.

Definition at line 44 of file classlib.cpp.

48{
50
51 PAGED_CODE();
52
53 Table[UcxIoDeviceControlTableIndex] = (PFN_UCXFUNC)UcxApiIoDeviceControl;
54 Table[UcxControllerCreateTableIndex] = (PFN_UCXFUNC)UcxApiControllerCreate;
55 Table[UcxControllerNeedsResetTableIndex] = (PFN_UCXFUNC)UcxApiControllerNeedsReset;
56 Table[UcxControllerResetCompleteTableIndex] = (PFN_UCXFUNC)UcxApiControllerResetComplete;
57 Table[UcxControllerSetFailedTableIndex] = (PFN_UCXFUNC)UcxApiControllerSetFailed;
58 Table[UcxRootHubCreateTableIndex] = (PFN_UCXFUNC)UcxApiRootHubCreate;
59 Table[UcxRootHubPortChangedTableIndex] = (PFN_UCXFUNC)UcxApiRootHubPortChanged;
60 Table[UcxUsbDeviceCreateTableIndex] = (PFN_UCXFUNC)UcxApiUsbDeviceCreate;
62 Table[UcxUsbDeviceRemoteWakeNotificationTableIndex] = (PFN_UCXFUNC)UcxApiUsbDeviceRemoteWakeNotification;
63 Table[UcxEndpointCreateTableIndex] = (PFN_UCXFUNC)UcxApiEndpointCreate;
64 Table[UcxEndpointGetStaticStreamsReferencedTableIndex] = (PFN_UCXFUNC)UcxApiEndpointGetStaticStreamsReferenced;
65 Table[UcxEndpointNeedToCancelTransfersTableIndex] = (PFN_UCXFUNC)UcxApiEndpointNeedToCancelTransfers;
69 Table[UcxEndpointPurgeCompleteTableIndex] = (PFN_UCXFUNC)UcxApiEndpointPurgeComplete;
70 Table[UcxEndpointAbortCompleteTableIndex] = (PFN_UCXFUNC)UcxApiEndpointAbortComplete;
71 Table[UcxEndpointNoPingResponseErrorTableIndex] = (PFN_UCXFUNC)UcxApiEndpointNoPingResponseError;
73 Table[UcxStaticStreamsCreateTableIndex] = (PFN_UCXFUNC)UcxApiStaticStreamsCreate;
74 Table[UcxInitializeDeviceInitTableIndex] = (PFN_UCXFUNC)UcxApiInitializeDeviceInit;
75 Table[UcxControllerSetIdStringsTableIndex] = (PFN_UCXFUNC)UcxApiControllerSetIdStrings;
77 (PFN_UCXFUNC)UcxApiControllerNotifyTransportCharacteristicsChange;
78
79 return STATUS_SUCCESS;
80}
PAGED_CODE()
return STATUS_SUCCESS
Definition: classlib.cpp:139
static PFN_UCXFUNC UcxExportTable[UcxFunctionTableNumEntries]
Definition: classlib.cpp:13
VOID NTAPI UcxApiDefaultEndpointInitSetEventCallbacks(_In_ PUCX_DRIVER_GLOBALS DriverGlobals, _Inout_ PUCXENDPOINT_INIT EndpointInit, _In_ PUCX_DEFAULT_ENDPOINT_EVENT_CALLBACKS EventCallbacks)
Definition: exports.cpp:299
VOID NTAPI UcxApiUsbDeviceInitSetEventCallbacks(_In_ PUCX_DRIVER_GLOBALS DriverGlobals, _Inout_ PUCXUSBDEVICE_INIT UsbDeviceInit, _In_ PUCX_USBDEVICE_EVENT_CALLBACKS EventCallbacks)
Definition: exports.cpp:207
VOID NTAPI UcxApiStaticStreamsSetStreamInfo(_In_ PUCX_DRIVER_GLOBALS DriverGlobals, _In_ UCXSSTREAMS StaticStreams, _In_ PSTREAM_INFO StreamInfo)
Definition: exports.cpp:363
VOID NTAPI UcxApiEndpointSetWdfIoQueue(_In_ PUCX_DRIVER_GLOBALS DriverGlobals, _In_ UCXENDPOINT Endpoint, _In_ WDFQUEUE WdfQueue)
Definition: exports.cpp:312
VOID NTAPI UcxApiEndpointInitSetEventCallbacks(_In_ PUCX_DRIVER_GLOBALS DriverGlobals, _Inout_ PUCXENDPOINT_INIT EndpointInit, _In_ PUCX_ENDPOINT_EVENT_CALLBACKS EventCallbacks)
Definition: exports.cpp:286
ASMGENDATA Table[]
Definition: genincdata.c:61
@ UcxIoDeviceControlTableIndex
Definition: ucxfuncenum.h:13
@ UcxControllerSetIdStringsTableIndex
Definition: ucxfuncenum.h:35
@ UcxEndpointInitSetEventCallbacksTableIndex
Definition: ucxfuncenum.h:26
@ UcxEndpointPurgeCompleteTableIndex
Definition: ucxfuncenum.h:29
@ UcxStaticStreamsCreateTableIndex
Definition: ucxfuncenum.h:33
@ UcxEndpointGetStaticStreamsReferencedTableIndex
Definition: ucxfuncenum.h:24
@ UcxRootHubPortChangedTableIndex
Definition: ucxfuncenum.h:19
@ UcxEndpointSetWdfIoQueueTableIndex
Definition: ucxfuncenum.h:28
@ UcxUsbDeviceRemoteWakeNotificationTableIndex
Definition: ucxfuncenum.h:22
@ UcxUsbDeviceCreateTableIndex
Definition: ucxfuncenum.h:20
@ UcxControllerCreateTableIndex
Definition: ucxfuncenum.h:14
@ UcxStaticStreamsSetStreamInfoTableIndex
Definition: ucxfuncenum.h:32
@ UcxEndpointNeedToCancelTransfersTableIndex
Definition: ucxfuncenum.h:25
@ UcxEndpointNoPingResponseErrorTableIndex
Definition: ucxfuncenum.h:31
@ UcxControllerResetCompleteTableIndex
Definition: ucxfuncenum.h:16
@ UcxControllerSetFailedTableIndex
Definition: ucxfuncenum.h:17
@ UcxRootHubCreateTableIndex
Definition: ucxfuncenum.h:18
@ UcxDefaultEndpointInitSetEventCallbacksTableIndex
Definition: ucxfuncenum.h:27
@ UcxEndpointCreateTableIndex
Definition: ucxfuncenum.h:23
@ UcxEndpointAbortCompleteTableIndex
Definition: ucxfuncenum.h:30
@ UcxUsbDeviceInitSetEventCallbacksTableIndex
Definition: ucxfuncenum.h:21
@ UcxControllerNeedsResetTableIndex
Definition: ucxfuncenum.h:15
@ UcxInitializeDeviceInitTableIndex
Definition: ucxfuncenum.h:34
@ UcxControllerNotifyTransportCharacteristicsChangeTableIndex
Definition: ucxfuncenum.h:36
VOID(NTAPI * PFN_UCXFUNC)(VOID)
Definition: ucxglobals.h:21

◆ if() [1/4]

if ( ClassBindInfo->FunctionTableCount !  = UcxTableEntriesForMinor(Minor))

Definition at line 121 of file classlib.cpp.

122 {
123 DPRINT1("UCX 1.%lu client has %lu table slots\n", Minor, ClassBindInfo->FunctionTableCount);
125 }
#define DPRINT1
Definition: precomp.h:8
ULONG Minor
Definition: classlib.cpp:99
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135

◆ if() [2/4]

if ( ClassBindInfo->Version.Major !  = UCX_CLASS_MAJOR_VERSION || Minor,
UCX_CLASS_MINOR_VERSION   
)

Definition at line 111 of file classlib.cpp.

112 {
113 DPRINT1("Client wants UCX %lu.%lu, have %u.%u\n",
114 ClassBindInfo->Version.Major,
115 Minor,
119 }
#define STATUS_REVISION_MISMATCH
Definition: ntstatus.h:419
#define UCX_CLASS_MAJOR_VERSION
Definition: ucx01000.h:18
#define UCX_CLASS_MINOR_VERSION
Definition: ucx01000.h:19

◆ if() [3/4]

if ( ClientGlobals  = =NULL)

◆ if() [4/4]

if ( Globals  = =NULL)

◆ PAGED_CODE()

PAGED_CODE ( )

Referenced by _IRQL_requires_().

◆ RtlCopyMemory()

RtlCopyMemory ( ClassBindInfo->  FunctionTable,
UcxExportTable  ,
ClassBindInfo->FunctionTableCount *  sizeofUcxExportTable[0] 
)

◆ UcxTableEntriesForMinor()

static ULONG NTAPI UcxTableEntriesForMinor ( _In_ ULONG  Minor)
static

Definition at line 31 of file classlib.cpp.

33{
34 if (Minor >= 4)
36
37 /* SetIdStrings arrived in 1.3 */
38 if (Minor == 3)
40
42}
@ UcxFunctionTableNumEntries
Definition: ucxfuncenum.h:37

◆ UNREFERENCED_PARAMETER()

UNREFERENCED_PARAMETER ( ComponentGlobals  )

Variable Documentation

◆ ClientGlobals

* ClientGlobals = (PUCX_DRIVER_GLOBALS *)ClassBindInfo->ClassBindInfo

Definition at line 103 of file classlib.cpp.

Referenced by WdfVersionBindClass().

◆ ComponentGlobals

_In_ PWDF_COMPONENT_GLOBALS * ComponentGlobals
Initial value:
{
ClientGlobals
Definition: classlib.cpp:103
WDF_EXTERN_C_START struct _UCX_DRIVER_GLOBALS * PUCX_DRIVER_GLOBALS

Definition at line 95 of file classlib.cpp.

Referenced by WdfVersionBind(), and WdfVersionUnbind().

◆ Globals

Definition at line 98 of file classlib.cpp.

◆ Minor

◆ Size

Definition at line 131 of file classlib.cpp.

◆ STATUS_SUCCESS

return STATUS_SUCCESS

Definition at line 139 of file classlib.cpp.

Referenced by _IRQL_requires_().

◆ UcxClassLibraryInfo

WDF_CLASS_LIBRARY_INFO UcxClassLibraryInfo
Initial value:
=
{
UcxOnClassLoad,
UcxOnClassUnload,
UcxOnClientBind,
UcxOnClientUnbind
}
WDF_CLASS_LIBRARY_INFO UcxClassLibraryInfo
Definition: classlib.cpp:17

Definition at line 17 of file classlib.cpp.

Referenced by DriverEntry().

◆ UcxExportTable

PFN_UCXFUNC UcxExportTable[UcxFunctionTableNumEntries]
static

Definition at line 13 of file classlib.cpp.

Referenced by _IRQL_requires_().

◆ WdfDriverGlobals