Berger, Daniel
2008-Nov-26 14:34 UTC
[Win32utils-devel] Question about FindFirstVolumeMountPoint
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? Thanks, Dan This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments.
Heesob Park
2008-Nov-27 01:36 UTC
[Win32utils-devel] Question about FindFirstVolumeMountPoint
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