-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathdriver.cpp
More file actions
102 lines (72 loc) · 2.35 KB
/
driver.cpp
File metadata and controls
102 lines (72 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#include "pch.h"
#include "driver.h"
//
// This variable was used by the USB3 kernel debug extension.
//
PDRIVER_OBJECT g_UdecxCamDriverObject;
PWDFDRIVER_UDECXMBIM_CONTEXT g_WdfDriverUdecxCamCtx = NULL;
extern "C"
NTSTATUS
DriverEntry(
struct _DRIVER_OBJECT *DriverObject,
PUNICODE_STRING RegistryPath
)
/*++
Routine Description:
DriverEntry is the first routine called after a driver is loaded,
and is responsible for initializing the driver.
--*/
{
NTSTATUS status;
WDFDRIVER wdfDriver;
WDF_OBJECT_ATTRIBUTES wdfAttributes;
WDF_DRIVER_CONFIG wdfDriverConfig;
PAGED_CODE();
g_UdecxCamDriverObject = DriverObject;
PRINTLINE("Enter");
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&wdfAttributes, WDFDRIVER_UDECXMBIM_CONTEXT);
wdfAttributes.EvtCleanupCallback = DriverCleanup;
WDF_DRIVER_CONFIG_INIT(&wdfDriverConfig, &ControllerWdfEvtDeviceAdd);
wdfDriverConfig.DriverPoolTag = UDECXVDEV_POOL_TAG;
status = WdfDriverCreate(DriverObject,
RegistryPath,
&wdfAttributes,
&wdfDriverConfig,
&wdfDriver);
if (!NT_SUCCESS(status)) {
DbgPrint("DriverEntry failed");
//
// DriverCleanup will not be called since the WdfDriver object
// failed to create. Clean-up any resources that were created
// prior to WDF driver creation.
//
//WPP_CLEANUP(DriverObject);
return status;
}
//
// Initialize the global controller list.
//
g_WdfDriverUdecxCamCtx = WdfDriverGetUdecxCamCtx(wdfDriver);
//InitializeListHead(&g_WdfDriverUdecxCamCtx->ControllerListHead);
//KeInitializeSpinLock(&g_WdfDriverUdecxCamCtx->ControllerListLock);
//g_WdfDriverUdecxCamCtx->ControllerListCount = 0;
return status;
}
#if 1
VOID
DriverCleanup(
WDFOBJECT WdfDriver
)
/*++
Routine Description:
The driver's EvtCleanupCallback event callback function removes the driver's
references on an object so that the object can be deleted.
--*/
{
PAGED_CODE();
PRINTLINE("Enter");
//WPP_CLEANUP(WdfDriverWdmGetDriverObject((WDFDRIVER)WdfDriver));
UNREFERENCED_PARAMETER(WdfDriver);
return;
}
#endif