728x90
반응형
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NTSTATUS | |
DriverEntry( | |
IN PDRIVER_OBJECT DriverObject, | |
IN PUNICODE_STRING RegistryPath | |
) | |
{ | |
WDF_DRIVER_CONFIG config; | |
WDFDRIVER hDriver; | |
NTSTATUS status; | |
WDF_OBJECT_ATTRIBUTES attributes; | |
// | |
// Initialize WPP tracing. | |
// | |
WPP_INIT_TRACING( | |
DriverObject, | |
RegistryPath | |
); | |
SerialDbgPrintEx( | |
TRACE_LEVEL_INFORMATION, | |
DBG_INIT, | |
"Serial Sample (WDF Version) - Built %s %s\n", | |
__DATE__, __TIME__ | |
); | |
// | |
// Register a cleanup callback function (which calls WPP_CLEANUP) | |
// for the framework driver object. The framework will call | |
// the cleanup callback function when it deletes the driver object, | |
// before the driver is unloaded. | |
// | |
WDF_OBJECT_ATTRIBUTES_INIT(&attributes); | |
attributes.EvtCleanupCallback = SerialEvtDriverContextCleanup; | |
WDF_DRIVER_CONFIG_INIT( | |
&config, | |
SerialEvtDeviceAdd | |
); | |
status = WdfDriverCreate( | |
DriverObject, | |
RegistryPath, | |
&attributes, | |
&config, | |
&hDriver | |
); | |
if (!NT_SUCCESS(status)) { | |
SerialDbgPrintEx( | |
TRACE_LEVEL_ERROR, | |
DBG_INIT, | |
"WdfDriverCreate failed with status 0x%x\n", | |
status | |
); | |
// | |
// Clean up tracing here because WdfDriverCreate failed. | |
// | |
WPP_CLEANUP(DriverObject); | |
return status; | |
} | |
// | |
// Call an internal routine to obtain registry values | |
// to use for all the devices that the driver | |
// controls, including whether or not to break on entry. | |
// | |
SerialGetConfigDefaults( | |
&driverDefaults, | |
hDriver | |
); | |
// | |
// Break on entry if requested bt registry value. | |
// | |
if (driverDefaults.ShouldBreakOnEntry) { | |
DbgBreakPoint(); | |
} | |
return status; | |
} |
728x90
반응형
'C C++' 카테고리의 다른 글
C++ std::any (0) | 2019.08.22 |
---|---|
libcurl 빌드 하기 (Visual Sutdio) (0) | 2019.08.15 |
[StackOverflow][Re] Create PDF document for printing in Qt from template (0) | 2018.10.22 |
curl & libcurl 7.62.0 for Visual Studio 2017 (0) | 2018.10.06 |
[C++] unique_ptr, shared_ptr, weak_ptr (0) | 2018.09.13 |