ReactOS 0.4.17-dev-1037-g720d112
ucxstub.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS USB Host Controller Extension
3 * LICENSE: MIT (https://spdx.org/licenses/MIT)
4 * PURPOSE: UCX client binding for drivers built in tree
5 * COPYRIGHT: Copyright 2026 Justin Miller <justinmiller100@gmail.com>
6 */
7
8/*
9 * Windows clients get bound by the KMDF stub walking .kmdfclassbind.
10 * wdfdriverentry has no such walk, so clients call in here instead.
11 */
12
13#include <ntddk.h>
14#include <windef.h>
15#include <fxldr.h>
16#include <wdf.h>
17#include <ucxclass.h>
18#include "ucxstub.h"
19
20#define NDEBUG
21#include <debug.h>
22
23/* The UCX header set this library is built against */
24#define UCX_STUB_MAJOR_VERSION 1
25#define UCX_STUB_MINOR_VERSION 6
26
27/* Owned by wdfdriverentry */
30
33
36
40UcxStubBindClass(VOID)
41{
44
45 PAGED_CODE();
46
47 if (UcxStubBound)
48 return STATUS_SUCCESS;
49
50 RtlZeroMemory(Info, sizeof(*Info));
51 Info->Size = sizeof(*Info);
52 Info->ClassName = (PWCHAR)L"Ucx";
53 Info->Version.Major = UCX_STUB_MAJOR_VERSION;
54 Info->Version.Minor = UCX_STUB_MINOR_VERSION;
55 Info->FunctionTable = UcxFunctions;
56 Info->FunctionTableCount = UcxFunctionTableNumEntries;
57 Info->ClassBindInfo = &UcxDriverGlobals;
58
59 /* Typed as PWDF_COMPONENT_GLOBALS*, but clients pass the globals pointer itself */
61 if (!NT_SUCCESS(Status))
62 {
63 DPRINT1("UCX class bind failed 0x%lx\n", Status);
64 return Status;
65 }
66
68 return STATUS_SUCCESS;
69}
70
72VOID
74UcxStubUnbindClass(VOID)
75{
76 PAGED_CODE();
77
78 if (!UcxStubBound)
79 return;
80
82
86}
#define PAGED_CODE()
unsigned char BOOLEAN
Definition: actypes.h:127
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define L(x)
Definition: resources.c:13
#define _IRQL_requires_(irql)
Definition: driverspecs.h:229
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
Status
Definition: gdiplustypes.h:24
#define STATUS_SUCCESS
Definition: shellext.h:65
#define NTAPI
Definition: typedefs.h:36
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint16_t * PWCHAR
Definition: typedefs.h:56
@ UcxFunctionTableNumEntries
Definition: ucxfuncenum.h:37
WDF_EXTERN_C_START struct _UCX_DRIVER_GLOBALS * PUCX_DRIVER_GLOBALS
VOID(NTAPI * PFN_UCXFUNC)(VOID)
Definition: ucxglobals.h:21
PFN_UCXFUNC UcxFunctions[UcxFunctionTableNumEntries]
Definition: ucxstub.c:31
PWDF_DRIVER_GLOBALS WdfDriverGlobals
Definition: classlib.cpp:132
static BOOLEAN UcxStubBound
Definition: ucxstub.c:35
#define UCX_STUB_MAJOR_VERSION
Definition: ucxstub.c:24
static WDF_CLASS_BIND_INFO UcxStubClassBindInfo
Definition: ucxstub.c:34
#define UCX_STUB_MINOR_VERSION
Definition: ucxstub.c:25
PUCX_DRIVER_GLOBALS UcxDriverGlobals
Definition: ucxstub.c:32
WDF_BIND_INFO BindInfo
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
VOID NTAPI WdfVersionUnbindClass(_In_ PWDF_BIND_INFO BindInfo, _In_ PWDF_COMPONENT_GLOBALS Globals, _In_ PWDF_CLASS_BIND_INFO ClassBindInfo)
Definition: wdfldr.c:850
NTSTATUS NTAPI WdfVersionBindClass(_In_ PWDF_BIND_INFO BindInfo, _Inout_ PWDF_COMPONENT_GLOBALS *Globals, _In_ PWDF_CLASS_BIND_INFO ClassBindInfo)
Definition: wdfldr.c:794