草庐IT

windows - 错误 LNK2019 : unresolved external symbol __CheckForDebuggerJustMyCode referenced in function DriverEntry

coder 2023-11-10 原文

我编写了一个 Windows 10 驱动程序。

下面是代码,实际上代码是learn.microsoft.com的示例。

有没有人知道我应该做什么来处理这个问题。

#include <ntddk.h>
#include <wdf.h>


DRIVER_INITIALIZE DriverEntry;
EVT_WDF_DRIVER_DEVICE_ADD KmdfHelloWorldEvtDeviceAdd;


NTSTATUS
DriverEntry(
    _In_ PDRIVER_OBJECT     DriverObject,
    _In_ PUNICODE_STRING    RegistryPath
)
{
    // NTSTATUS variable to record success or failure
    NTSTATUS status = STATUS_SUCCESS;

    // Allocate the driver configuration object
    WDF_DRIVER_CONFIG config;

    // Print "Hello World" for DriverEntry
    KdPrintEx((DPFLTR_IHVDRIVER_ID, DPFLTR_INFO_LEVEL, "KmdfHelloWorld: DriverEntry\n"));

    // Initialize the driver configuration object to register the
    // entry point for the EvtDeviceAdd callback, KmdfHelloWorldEvtDeviceAdd
    WDF_DRIVER_CONFIG_INIT(&config,
        KmdfHelloWorldEvtDeviceAdd
    );

    // Finally, create the driver object
    status = WdfDriverCreate(DriverObject,
        RegistryPath,
        WDF_NO_OBJECT_ATTRIBUTES,
        &config,
        WDF_NO_HANDLE
    );
    return status;
}


NTSTATUS
KmdfHelloWorldEvtDeviceAdd(
    _In_    WDFDRIVER       Driver,
    _Inout_ PWDFDEVICE_INIT DeviceInit
)
{
    // We're not using the driver object,
    // so we need to mark it as unreferenced
    UNREFERENCED_PARAMETER(Driver);

    NTSTATUS status;

    // Allocate the device object
    WDFDEVICE hDevice;

    // Print "Hello World"
    KdPrintEx((DPFLTR_IHVDRIVER_ID, DPFLTR_INFO_LEVEL, "KmdfHelloWorld: KmdfHelloWorldEvtDeviceAdd\n"));

    // Create the device object
    status = WdfDeviceCreate(&DeviceInit,
        WDF_NO_OBJECT_ATTRIBUTES,
        &hDevice
    );
    return status;
}

帮助!如果您有任何建议,请告诉我。

错误信息是:

Driver.obj : error LNK2019: unresolved external symbol __CheckForDebuggerJustMyCode referenced in function DriverEntry

最佳答案

这与新的C++ Just My Code Stepping有关Visual Studio 2017 15.8 中的功能。

如果出现错误,请打开“项目属性”对话框并将“配置属性 -> C/C++ -> 常规 -> 仅支持我的代码调试”选项设置为否。

关于windows - 错误 LNK2019 : unresolved external symbol __CheckForDebuggerJustMyCode referenced in function DriverEntry,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51853537/

有关windows - 错误 LNK2019 : unresolved external symbol __CheckForDebuggerJustMyCode referenced in function DriverEntry的更多相关文章

随机推荐