Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
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.

C++
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
Posted
Updated 13-Aug-11 6:04am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900