first stab at sparse files support

This commit is contained in:
Arvid Norberg
2007-04-17 21:54:40 +00:00
parent 3794b49e3a
commit 16e17f066c
6 changed files with 139 additions and 15 deletions

View File

@@ -39,6 +39,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <sstream>
#include <windows.h>
#include <winioctl.h>
namespace
{
@@ -172,6 +173,10 @@ namespace libtorrent
std::stringstream s;
throw_exception(file_name);
}
// try to make the file sparse if supported
DWORD temp;
::DeviceIoControl(new_handle, FSCTL_SET_SPARSE, 0, 0
, 0, 0, &temp, 0);
// will only close old file if the open succeeded
close();
m_file_handle = new_handle;