I am a newbie to kernel development and excuse me if this sounds like a stupid question.
I am trying to mount a virtual file disk and then format it using fmifs.dll. The steps I am following are as below :
Kernel Mode :
Create Device initially and start its thread
UserMode (win32) :
Create File (The file to be used for our virtual drive store). Set its required size and close file.
DefineDOSDevice to create a symbolic link between kernel device name and \.\I: drive.
CreateFile(“\.\I:”,…) to get a handle to our device
DeviceIoControl(handle to device,IOCTL_FILE_DISK_OPEN_FILE, and our file information)
In the Kernel driver, I take the following steps on receiving IOCTL_FILE_DISK_OPEN_FILE
Copy file information to device extension
ZwCreateFile to open the file created in win32 and obtain necessary file information
To create a new mount point, I am calling the MOUNTMGR_DEVICE_NAME with IOCTL_MOUNTMGR_CREATE_POINT. This returns an error code : F74BB47A. (STATUS_OBJECT_NAME_NOT_FOUND)
I then call IoCreateSymbolicLink to create symbolic link to DosDevice, which returns error : STATUS_OBJECT_NAME_COLLISION : C0000035
I am able to format using the fmifs.dll and the drive letter appears in explorer. However no volume mount point is created.
Is the error on object_name_collision because I have already created the symbolic link in the user mode ?
Why do I get the Error : F74BB47A on IOCTL_MOUNTMGR_CREATE_POINT ?
Is this the way this problem should be handled ? Should I open the device in win32 without the DefineDosDevice ?
What is the best way to handle this problem ?
Many thanks in advance.
Debendra