Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 6369

Can't install a simple kdmf driver. Driver has been blocked from loading

$
0
0

My driver is being blocked for some reason on testing virtual box with windows 10. It throws me this error - https://prnt.sc/r2raz4 Quite confused about that, because more complex driver works fine by the same loader.

The source is quite basic. It only creates the IOCTL device and symlink (Yea. Starting to implement that :D)

#include <ntddk.h>
#include <wdf.h>
#include <wdm.h>
#include <windot11.h>
#include "C:\\Users\\Raitis\\Desktop\\VS Projects\\KMDF Driver1\\KMDF Driver1\\Mod_NtIfs.h"
#include <ntdef.h>

DRIVER_INITIALIZE DriverEntry;

UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\TestDevice");
PDEVICE_OBJECT DeviceObject;
UNICODE_STRING SymLinkName = RTL_CONSTANT_STRING("\\??\\MyLink");

VOID Unload(PDRIVER_OBJECT DriverObject)
{
    IoDeleteSymbolicLink(&SymLinkName);
    IoDeleteDevice(DeviceObject);
    KdPrint(("Driver Unloaded"));
}

NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
{
    NTSTATUS status;

    DriverObject->DriverUnload = Unload;

    status = IoCreateDevice(DriverObject, 0, &DeviceName, FILE_DEVICE_UNKNOWN, FILE_DEVICE_SECURE_OPEN, 0, &DeviceObject);

    if (!NT_SUCCESS(status))
    {
        KdPrint(("Creating Device Has Failed"));
        return status;
    }

    status = IoCreateSymbolicLink(&SymLinkName, &DeviceName);

    if (!NT_SUCCESS(status));
    {
        KdPrint(("Creating Symlink Failed \r\n"));
        IoDeleteDevice(DeviceObject);
        return status;
    }

    KdPrint(("Driver Loaded\r\n"));

    return status;
}


Viewing all articles
Browse latest Browse all 6369

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>