summaryrefslogtreecommitdiff
path: root/nfc/Simulator/Src/Driver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'nfc/Simulator/Src/Driver.cpp')
-rw-r--r--nfc/Simulator/Src/Driver.cpp70
1 files changed, 70 insertions, 0 deletions
diff --git a/nfc/Simulator/Src/Driver.cpp b/nfc/Simulator/Src/Driver.cpp
new file mode 100644
index 00000000..5082e3b4
--- /dev/null
+++ b/nfc/Simulator/Src/Driver.cpp
@@ -0,0 +1,70 @@
+/*++
+
+Copyright (C) Microsoft Corporation, All Rights Reserved.
+
+Module Name:
+
+ Driver.cpp
+
+Abstract:
+
+ This module contains the implementation of the UMDF driver callback object.
+
+Environment:
+
+ Windows User-Mode Driver Framework (WUDF)
+
+--*/
+
+#include "Internal.h"
+#include "Driver.tmh"
+
+DECLARE_TRACING_TLS;
+
+NTSTATUS
+DriverEntry(
+ _In_ PDRIVER_OBJECT DriverObject,
+ _In_ PUNICODE_STRING RegistryPath
+ )
+{
+ NTSTATUS Status = STATUS_SUCCESS;
+ WDF_DRIVER_CONFIG Config;
+
+ WPP_INIT_TRACING(DriverObject, RegistryPath);
+ TracingTlsInitialize();
+
+ FunctionEntry("...");
+
+ WDF_DRIVER_CONFIG_INIT(&Config, CDevice::OnDeviceAdd);
+ Config.EvtDriverUnload = OnDriverUnload;
+
+ Status = WdfDriverCreate(
+ DriverObject,
+ RegistryPath,
+ WDF_NO_OBJECT_ATTRIBUTES,
+ &Config,
+ WDF_NO_HANDLE);
+
+ if (!NT_SUCCESS(Status)) {
+ TraceInfo("WdfDriverCreate failed with Status %!STATUS!", Status);
+ goto Exit;
+ }
+
+Exit:
+ if (!NT_SUCCESS(Status)) {
+ TracingTlsFree();
+ WPP_CLEANUP(DriverObject);
+ }
+ FunctionReturn(Status, "Status = %!STATUS!", Status);
+}
+
+VOID
+OnDriverUnload(
+ _In_ WDFDRIVER Driver
+ )
+{
+ UNREFERENCED_PARAMETER(Driver);
+
+ TracingTlsFree();
+ WPP_CLEANUP(WdfDriverWdmGetDriverObject(Driver));
+}