-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDriver.cpp
More file actions
103 lines (85 loc) · 2.4 KB
/
Driver.cpp
File metadata and controls
103 lines (85 loc) · 2.4 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
103
// SPDX-License-Identifier: MS-PL
//
// Copyright (C) Microsoft Corporation, All Rights Reserved.
// Copyright (C) Framework Computer Inc, All Rights Reserved.
//
// Abstract:
//
// This module contains the implementation of entry and exit point of Framework Sensors driver.
//
// Environment:
//
// Windows User-Mode Driver Framework (WUDF)
#include "Clients.h"
#include "Driver.h"
#include "Driver.tmh"
//------------------------------------------------------------------------------
// Function: DriverEntry
//
// This routine is the driver initialization entry point.
//
// Arguments:
// DriverObject: IN: Pointer to the driver object created by the I/O manager
// RegistryPath: IN: Pointer to the driver specific registry key
//
// Return Value:
// NTSTATUS code
//------------------------------------------------------------------------------
NTSTATUS
DriverEntry(
_In_ PDRIVER_OBJECT DriverObject,
_In_ PUNICODE_STRING RegistryPath
)
{
WDF_DRIVER_CONFIG DriverConfig;
NTSTATUS Status = STATUS_SUCCESS;
//
// Initialize WPP Tracing
//
WPP_INIT_TRACING(DriverObject, NULL);
SENSOR_FunctionEnter();
DriverConfig.DriverPoolTag = SENSORV2_POOL_TAG_COMBO;
//
// Initialize the driver configuration structure.
//
WDF_DRIVER_CONFIG_INIT(&DriverConfig, OnDeviceAdd);
DriverConfig.EvtDriverUnload = OnDriverUnload;
//
// Create a framework driver object to represent our driver.
//
Status = WdfDriverCreate(DriverObject,
RegistryPath,
WDF_NO_OBJECT_ATTRIBUTES,
&DriverConfig,
WDF_NO_HANDLE);
if (!NT_SUCCESS(Status))
{
TraceError("COMBO %!FUNC! WdfDriverCreate failed: %!STATUS!", Status);
goto Exit;
}
Exit:
SENSOR_FunctionExit(Status);
return Status;
}
//------------------------------------------------------------------------------
// Function: OnDriverUnload
//
// This routine is called when the driver unloads.
//
// Arguments:
// Driver: IN: driver object
//
// Return Value:
// NTSTATUS code
//------------------------------------------------------------------------------
VOID
OnDriverUnload(
_In_ WDFDRIVER Driver
)
{
SENSOR_FunctionEnter();
UNREFERENCED_PARAMETER(Driver);
SENSOR_FunctionExit(STATUS_SUCCESS);
WPP_CLEANUP(Driver);
return;
}