Código
#include <ntddk.h> const WCHAR Device[]=L"\\Device\\bananas"; //modo kernell const WCHAR sLink[]=L"\\DosDevices"; //modo usuario UNICODE_STRING Dev,lnk; NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject,PUNICODE_STRING RegistryPath) { NTSTATUS s; unsigned int i; //DriverObject->DriverUnload=Salir; for(i=0;i<IRP_MJ_MAXIMUM_FUNCTION;i++) { // DriverObject->MajorFunction[i]=Control; } RtlInitUnicodeString(&Dev,Device); RtlInitUnicodeString(&lnk,sLink); s=IoCreateDevice(DriverObject,0,&Dev,FILE_DEVICE_UNKNOWN,0,0,&DriverObject->DeviceObject); if (NT_SUCCESS(s)) { s=IoCreateSymbolicLink(&lnk,&Dev); if(!NT_SUCCESS(s)) { IoDeleteDevice(DriverObject->DeviceObject); DbgPrint("Linking Error"); } else { DbgPrint("Cargado"); } } else { DbgPrint("Error IoCreate"); } return STATUS_SUCCESS; }
Con este codigo me da "Linking Error", con lo cual el DeviceObject debería estar creado y llamarse "bananas", pero he buscado con el WinObject dentro del directorio "Device" y no he visto el objeto creado.
¿No debería de haberse creado el objeto "bananas" dentro del directorio "Device"?
Además tampoco he visto por ningún sitio el directorio DosDevices.
Un saludo.





Autor


En línea


