Hi everyone, I have made a minifilter driver which only attaches itself to usb
devices. I want it to look for a certain file on the device as soon as it
attaches.
please correct me if I am wrong.
so to specify the name of the specific file, you need to get
the device name first? so to get the device name you
call FltGetDiskDeviceObject() and then IoVolumeDeviceToDosName()? Then you
add the file name you want to open at the end of the Dos Device name?
as an example: "L"\\DosDevices\\D:\\" + "test.txt"
Then you call InitializeObjectAttribute()?
after that you try to open the file using FltCreateFile()?
so at this point I am still trying to get the dos name of the device. I have written the code below in the pre operation callback function in the
passThrough sample as I am using %DDK%\src\filesys\miniFilter\passThrough
sample to do this.
NTSTATUS status;
UNICODE_STRING fileName;
ULONG length;
PFLT_VOLUME volume;
PDEVICE_OBJECT DiskDeviceObject;
UNICODE_STRING dosName;
volume = FltObjects->Volume;
status = FltGetDiskDeviceObject(volume, &DiskDeviceObject);
if(!NT_SUCCESS(status))
{
DbgPrint("Could not create the DiskDeviceObject\n");
}
RtlInitUnicodeString(&dosName, NULL);
if(NT_SUCCESS(status)){
DbgPrint("The object created sucessfully\n");
status = IoVolumeDeviceToDosName(DiskDeviceObject, &dosName);
}
if(NT_SUCCESS(status)){
DbgPrint("successfully retrieved the name of the device\n");
}
ObDereferenceObject( DiskDeviceObject );
But When I pluged in a usb device it does not mount the device, which means that the device does not appear in my computer. But if I start the service when the device is already mounted. it somebody please help me?
Thank you
Chathura