summaryrefslogtreecommitdiff
path: root/Sensors/Pedometer/driver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Sensors/Pedometer/driver.cpp')
-rw-r--r--Sensors/Pedometer/driver.cpp76
1 files changed, 76 insertions, 0 deletions
diff --git a/Sensors/Pedometer/driver.cpp b/Sensors/Pedometer/driver.cpp
new file mode 100644
index 00000000..d9fb3ca2
--- /dev/null
+++ b/Sensors/Pedometer/driver.cpp
@@ -0,0 +1,76 @@
+//Copyright (C) Microsoft Corporation, All Rights Reserved.
+//
+//Abstract:
+//
+// This module contains the implementation of entry and exit point of pedometer sample driver.
+//
+//Environment:
+//
+// Windows User-Mode Driver Framework (UMDF)
+
+#include "Device.h"
+#include "Driver.h"
+
+#include "Driver.tmh"
+
+
+
+// This routine is the driver initialization entry point.
+NTSTATUS
+DriverEntry(
+ _In_ PDRIVER_OBJECT DriverObject, // Pointer to the driver object created by the I/O manager
+ _In_ PUNICODE_STRING RegistryPath // Pointer to the driver specific registry key
+ )
+{
+ WDF_DRIVER_CONFIG DriverConfig;
+ NTSTATUS Status = STATUS_SUCCESS;
+
+ // Initialize WPP Tracing
+ WPP_INIT_TRACING(DriverObject, NULL);
+
+ SENSOR_FunctionEnter();
+
+ DriverConfig.DriverPoolTag = SENSOR_POOL_TAG_PEDOMETER;
+
+ // Initialize the driver configuration structure.
+ WDF_DRIVER_CONFIG_INIT(&DriverConfig, PedometerDevice::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("PED %!FUNC! WdfDriverCreate failed: %!STATUS!", Status);
+ goto Exit;
+ }
+
+Exit:
+ SENSOR_FunctionExit(Status);
+
+ return Status;
+}
+
+
+
+// This routine is called when the driver unloads.
+VOID
+OnDriverUnload(
+ _In_ WDFDRIVER Driver // Driver object
+ )
+{
+ SENSOR_FunctionEnter();
+
+ SENSOR_FunctionExit(STATUS_SUCCESS);
+
+ // WPP_CLEANUP doesn't actually use the Driver parameter
+ // So we need to set it as unreferenced.
+ UNREFERENCED_PARAMETER(Driver);
+ WPP_CLEANUP(WdfDriverWdmGetDriverObject(Driver));
+
+ return;
+} \ No newline at end of file