search for: disk_geometry

Displaying 1 result from an estimated 1 matches for "disk_geometry".

2008 May 06
4
DeviceIoControl + IOCTL_DISK_GET_DRIVE_GEOMETRY problem
...Windows::DeviceIO include Windows::Handle include Windows::Error fh = File.open(''test.txt'') # Assume you have this handle = get_osfhandle(fh.fileno) if handle == INVALID_HANDLE_VALUE puts "get_osfhandle failed" fh.close exit end buf = 0.chr * 24 # sizeof(DISK_GEOMETRY) bytes = [0].pack(''L'') bool = DeviceIoControl( handle, IOCTL_DISK_GET_DRIVE_GEOMETRY(), # 458752 nil, 0, buf, buf.size, bytes, 0 ) # Fails here unless bool puts "DeviceIoControl failed: " + get_last_error fh.close exit End fh.close Th...