[Win32utils-devel] Question about FindFirstVolumeMountPoint

Heesob Park phasis at gmail.com
Wed Nov 26 20:36:00 EST 2008


Hi,

2008/11/26 Berger, Daniel <Daniel.Berger at qwest.com>:
> Hi,
>
> I can't seem to get FindFirstVolumeMountPoint to work. What am I doing
> wrong?
>
> require 'windows/volume'
> require 'windows/handle'
> require 'windows/error'
>
> include Windows::Volume
> include Windows::Handle
> include Windows::Error
>
> vol = 0.chr * 512
> handle = FindFirstVolume(vol, vol.length)
>
> if handle == INVALID_HANDLE_VALUE
>   raise get_last_error
> end
>
> vol.strip!
> p vol # => \\\\?\\Volume{b4379d44-726d-11dc-87ec-806d6112693f}\\
>
> FindVolumeClose(handle)
>
> mp = 0.chr * 260
> mhandle = FindFirstVolumeMountPoint(vol, mp, mp.length)
>
> if mhandle == INVALID_HANDLE_VALUE
>   raise get_last_error # ERROR => There are no more files.
> (RuntimeError)
> end
>
> p mp.strip
>
> FindVolumeMountPointClose(mhandle)
>
> I've probably misread the directions somewhere. Any suggestions?
>
That is a normal result for no mounted folders.

Refer to http://msdn.microsoft.com/en-us/library/aa365733(VS.85).aspx

First, you can create mounted folders like this

c:\> mkdir c:\mnt\cdrive
c:\> mountvol c:\mnt\cdrive \\?\Volume{b4379d44-726d-11dc-87ec-806d6112693f}\

Next, If you run the ruby code, the result is
"mnt\\cdrive\\"

Regards,

Park Heesob


More information about the win32utils-devel mailing list