summaryrefslogtreecommitdiff
path: root/sensors/Activity/driver.cpp
diff options
context:
space:
mode:
authorDave Wilson <[email protected]>2015-03-17 19:50:07 -0700
committerDave Wilson <[email protected]>2015-03-17 19:50:07 -0700
commit97cf5197cf5b882b2c689d8dc2b555f2edf8f418 (patch)
tree46f3701832d70b420eb0fc0eb93261f9da45db3f /sensors/Activity/driver.cpp
parentef1905bf1e8825bb31120dfb27e0daf3154d859a (diff)
Initial publish
Diffstat (limited to 'sensors/Activity/driver.cpp')
-rw-r--r--sensors/Activity/driver.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/sensors/Activity/driver.cpp b/sensors/Activity/driver.cpp
new file mode 100644
index 00000000..b501f30a
--- /dev/null
+++ b/sensors/Activity/driver.cpp
@@ -0,0 +1,55 @@
+// Copyright (C) Microsoft Corporation, All Rights Reserved.
+//
+// Abstract:
+// This module contains the implementation of entry and exit point of activity sample driver.
+//
+// Environment:
+// Windows User-Mode Driver Framework (UMDF)
+
+#include "Device.h"
+#include "Driver.h"
+#include "Driver.tmh"
+
+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_ACTIVITY;
+
+ // Initialize the driver configuration structure.
+ WDF_DRIVER_CONFIG_INIT(&driverConfig, ActivityDevice::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("ACT %!FUNC! WdfDriverCreate failed: %!STATUS!", status);
+ }
+
+ SENSOR_FunctionExit(status);
+ return status;
+}
+
+// This routine is called when the driver unloads.
+VOID OnDriverUnload(_In_ WDFDRIVER driver)
+{
+ 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