SetVolumeMountPoint don't work with GetLastError = 87

hello ,
I developped a driver for mount virtual disk RAW ,
and SetVolumeMountPoint don’t work !
It return GetLastError = 87.

I implemented ioctl ‘IOCTL_MOUNTDEV_QUERY_DEVICE_NAME’ but SetVolumeMountPoint don’t work with error 87 !
How trace error ?
Thank !

Thank you help.

Did you copy the driver from the web somewhere? Where? Does a drive letter get assigned for it?

@Tim_Roberts said:
Did you copy the driver from the web somewhere? Where? Does a drive letter get assigned for it?

It’s a driver that I made myself, to mount disks with drive (eg drive g: ) it works (win 7,10) but when I use SetVolumeMountPoint in my path of my device \device\volume{guid}… then it doesn’t work.
It gives me error 87.
Why ???

Error 87 is ERROR_INVALID_PARAMETER. Have you triple-checked all the parameters in your call? Perhaps you could post your app code. Does your app work with other devices?

@Tim_Roberts said:
Error 87 is ERROR_INVALID_PARAMETER. Have you triple-checked all the parameters in your call? Perhaps you could post your app code. Does your app work with other devices?

SetVolumeMountPoint work on other device (eg. Truecrypt) but NOT WORK on my device !
What interests me is using this function on MY device!

Have you added debug prints of every ioctl you get? I’m not a disk guy, so I don’t know what ioctls are generated by the call, but it seems like you must be getting one you don’t handle.

@Tim_Roberts said:
Have you added debug prints of every ioctl you get? I’m not a disk guy, so I don’t know what ioctls are generated by the call, but it seems like you must be getting one you don’t handle.

Ioctl list supported by my driver and it"s conform and verified :
IOCTL_MOUNTDEV_QUERY_DEVICE_NAME which return \device\ddisk_vdisk_index_0

other ioctl supported by my device :
IOCTL_DISK_CHECK_VERIFY
IOCTL_DISK_GET_PARTITION_INFO_EX
IOCTL_DISK_UPDATE_DRIVE_SIZE
IOCTL_STORAGE_GET_DEVICE_NUMBER
IOCTL_DISK_CHECK_VERIFY
IOCTL_DISK_IS_WRITABLE
IOCTL_DISK_GET_LENGTH_INFO
IOCTL_VOLUME_GET_GPT_ATTRIBUTES
IOCTL_STORAGE_GET_DEVICE_NUMBER which return fixe number for trying mount disk into empty directory .

List code ioctl which is not supported by driver :
0x2d0c14
0x2d1400
0x4d0018

0x2d0c14 is IOCTL_STORAGE_GET_HOTPLUG_INFO
0x2d1400 is IOCTL_STORAGE_QUERY_PROPERTY
0x4d0018 is IOCTL_MOUNTDEV_QUERY_STABLE_GUID

It’ll take a disk driver guy to tell us which one is the key one.

IOCTL_MOUNTDEV_QUERY_STABLE_GUID is not documented and not implemented on truecrypt !
IOCTL_STORAGE_GET_HOTPLUG_INFO is documented but not implemented on truecrypt because so no need for this function to be able to mount a disk on a directory
IOCTL_STORAGE_QUERY_PROPERTY s documented but not implemented on truecrypt because so no need for this function to be able to mount a disk on a directory

@Gova_Gimer You’re missing the point … there are potentially three IOCTL’s that the OS is sending to you that it’s expecting a response from, and since it’s not getting one it happily shuts you down. @Tim_Roberts was good enough to decode them, you have three options for handling this …

  • Complain to MS that they are sending the IOCTL’s in error
  • Figure out why MS is sending those IOCTL’s (maybe you’ve told the OS that your are something that you’re not)
  • Handle them, usually by either completing them or by passing them down to the lower level

@craig_howard said:
@Gova_Gimer You’re missing the point … there are potentially three IOCTL’s that the OS is sending to you that it’s expecting a response from, and since it’s not getting one it happily shuts you down. @Tim_Roberts was good enough to decode them, you have three options for handling this …

  • Complain to MS that they are sending the IOCTL’s in error
  • Figure out why MS is sending those IOCTL’s (maybe you’ve told the OS that your are something that you’re not)
  • Handle them, usually by either completing them or by passing them down to the lower level

Short answer:
There is no need to implement them because truecrypt does not implement them.
And Setvolumemountpoint work in truecrypt and not in my driver.

ALSO :
FileSpy utility work good and return error :
4 21:11:30.897 devenv.exe IRP_MJ_FILE_SYSTEM_CONTROL/IRP_MN_MOUNT_VOLUME 00000042 STATUS_NO_MEDIA_IN_DEVICE
5 21:11:34.286 StandardCollector.Service.exe IRP_MJ_FILE_SYSTEM_CONTROL/IRP_MN_MOUNT_VOLUME 00000042 STATUS_NO_MEDIA_IN_DEVICE
6 21:11:34.451 StandardCollector.Service.exe IRP_MJ_FILE_SYSTEM_CONTROL/IRP_MN_MOUNT_VOLUME 00000042 STATUS_NO_MEDIA_IN_DEVICE

Sorry , i return never STATUS_NO_MEDIA_IN_DEVICE in my driver !!

ALSO :
Question:
I would like to submit a bug to microsoft because normally SetVolumeMountPoint is supposed to work in my device, which it is not, it gives me error 87 (ERROR_INVALID_PARAMETER) and the path exists!
How to submit?

So, FileSpy says your device is returning an error, and you don’t believe it? Is that what you’re saying?

You can certainly open a support ticket, but that costs money, and if the problem is not a Windows problem (which this is not), then they won’t refund the money.

IT’S NOT my driver which return STATUS_NO_MEDIA_IN_DEVICE ,Why ?
IRP IRP_MN_MOUNT_VOLUME is called in internal windows because is a disk driver rawdisk and not filesystem.

Something in your status is making the upper layers believe there is no media in the device.

@Gova_Gimer said:

@craig_howard said:
@Gova_Gimer You’re missing the point … there are potentially three IOCTL’s that the OS is sending to you that it’s expecting a response from, and since it’s not getting one it happily shuts you down. @Tim_Roberts was good enough to decode them, you have three options for handling this …

  • Complain to MS that they are sending the IOCTL’s in error
  • Figure out why MS is sending those IOCTL’s (maybe you’ve told the OS that your are something that you’re not)
  • Handle them, usually by either completing them or by passing them down to the lower level

Short answer:
There is no need to implement them because truecrypt does not implement them.
And Setvolumemountpoint work in truecrypt and not in my driver.

ALSO :
FileSpy utility work good and return error :
4 21:11:30.897 devenv.exe IRP_MJ_FILE_SYSTEM_CONTROL/IRP_MN_MOUNT_VOLUME 00000042 STATUS_NO_MEDIA_IN_DEVICE
5 21:11:34.286 StandardCollector.Service.exe IRP_MJ_FILE_SYSTEM_CONTROL/IRP_MN_MOUNT_VOLUME 00000042 STATUS_NO_MEDIA_IN_DEVICE
6 21:11:34.451 StandardCollector.Service.exe IRP_MJ_FILE_SYSTEM_CONTROL/IRP_MN_MOUNT_VOLUME 00000042 STATUS_NO_MEDIA_IN_DEVICE

Sorry , i return never STATUS_NO_MEDIA_IN_DEVICE in my driver !!

ALSO :
Question:
I would like to submit a bug to microsoft because normally SetVolumeMountPoint is supposed to work in my device, which it is not, it gives me error 87 (ERROR_INVALID_PARAMETER) and the path exists!
How to submit?

Hmm … the OS is making three IOCTL’s to you, the STORAGE_QUERY_PROPERTY one (that you’re not handling, as you stated) and STORAGE_GET_HOTPLUG_INFO (which you’re also not handling) both look suspiciously like the OS is asking “what are you?”. You don’t say, so the OS will pass that IOCTL to the next driver in the stack which also replies “I have no clue”. Ultimately the result of these IOCTL’s are that the OS has no idea what kind of device you might be, so it makes perfect sense that when you attempted to SetVolumeMountPoint() the OS would fail that call … because again, the OS has no idea what kind of media you are and that there is therefore STATUS_NO_MEDIA_IN_DEVICE

You seem to be really resistant to implementing a return to those three simple little calls, is that a philosophical difference with how you feel your driver works or is there a programmatic reason for that reason? Personally, if the OS asked if my device was a chicken (when I am actually a duck) and was only happy if it thought my duck was a chicken then I would say “yep, it’s a chicken!” … because at the end of the day, the OS is going to win …

1 Like

I will try to implement IOCTL_STORAGE_GET_HOTPLUG_INFO.
Yet truecrypt does not implement it yet!

For SetVolumeMountPoint to work correctly then
what are the ‘_STORAGE_PROPERTY_ID’ command lists should i implement for this ‘IOCTL_STORAGE_QUERY_PROPERTY’ ioctl?

Hmmm … this is another time that you’ve mentioned TrueCrypt [ https://en.wikipedia.org/wiki/TrueCrypt ] you do realize that this was/ is an open source file encryption method that had the final nails put into it’s coffin in 2014, yes? Veracrypt is still around but TrueCrypt is long dead and dust … which is likely why it doesn’t support those functions, and I can assure you never will support those functions … or anything else for that matter …

Are you trying to use Veracrypt? Probably asked a little later than should have been, but what problem are you attempting to solve?

@craig_howard said:
Hmmm … this is another time that you’ve mentioned TrueCrypt [ https://en.wikipedia.org/wiki/TrueCrypt ] you do realize that this was/ is an open source file encryption method that had the final nails put into it’s coffin in 2014, yes? Veracrypt is still around but TrueCrypt is long dead and dust … which is likely why it doesn’t support those functions, and I can assure you never will support those functions … or anything else for that matter …

Are you trying to use Veracrypt? Probably asked a little later than should have been, but what problem are you attempting to solve?

Yet truecrypt still works fine on windows 7,8,10.

@Gova_Gimer said:

@craig_howard said:
Hmmm … this is another time that you’ve mentioned TrueCrypt [ https://en.wikipedia.org/wiki/TrueCrypt ] you do realize that this was/ is an open source file encryption method that had the final nails put into it’s coffin in 2014, yes? Veracrypt is still around but TrueCrypt is long dead and dust … which is likely why it doesn’t support those functions, and I can assure you never will support those functions … or anything else for that matter …

Are you trying to use Veracrypt? Probably asked a little later than should have been, but what problem are you attempting to solve?

Yet truecrypt still works fine on windows 7,8,10.

Hmm … and yet here you are, totally unable to convince MS to mount your volume and essentially politely giving you the middle finger when you do …

At this point I think I’m done here (and as a sidenote, ZFS for Windows which is another open source filesystem [a mighty fine one too IMHO] mounts volumes very happily) …

EOF