HTTrack Website Copier
Free software offline browser - FORUM
Subject: snapshot volume/shadow volume with httrack
Author: Oskar Marcoy
Date: 03/28/2010 16:41
Hello, I am trying to use httrack with an shadowed volume, created by an
service like the shadow copy of windows on Win xp.

In C# I can use the following code to copy a file from the real volume to the
snapshot volume:

using System.Runtime.InteropServices;
using System;
using Microsoft.Win32.SafeHandles;
using System.IO;

namespace Shadow1{
	public class Edit{
		public const short FILE_ATTRIBUTE_NORMAL = 0x80;
		public const short INVALID_HANDLE_VALUE = -1;
		public const uint GENERIC_READ = 0x80000000;
		public const uint GENERIC_WRITE = 0x40000000;
		public const uint CREATE_NEW = 1;
		public const uint CREATE_ALWAYS = 2;
		public const uint OPEN_EXISTING = 3;

		[DllImport("kernel32.dll", SetLastError = true)]
		static extern IntPtr CreateFile(string lpFileName, uint dwDesiredAccess,
		                                uint dwShareMode, IntPtr
lpSecurityAttributes, uint dwCreationDisposition,
		                                uint dwFlagsAndAttributes, IntPtr


		[System.Runtime.InteropServices.DllImport("kernel32", SetLastError = true)]
		static extern  bool CloseHandle
				IntPtr hObject // handle to object
		public IntPtr SnapShotCreateFile(string RealVolumeFilePath){
			RealVolumeFilePath = "\\\\?\\SnapShot0\\" +
			return CreateFile(RealVolumeFilePath, GENERIC_WRITE, 0, IntPtr.Zero,
CREATE_NEW, 0, IntPtr.Zero);
		public void copyToShadow(string filePath){
			//string path = "meuTeste.txt";
			IntPtr SnapShotPTR = SnapShotCreateFile(filePath);
			SafeFileHandle safeSnapShotPTR = new SafeFileHandle(SnapShotPTR,true);
			Stream destStream = new FileStream(safeSnapShotPTR,FileAccess.Write);
			Stream originStream = new
			byte[] buffer = new byte[4096];
			//copying the original file to the snapshot
			for (;;)
				//reading original
				int bytesRead = originStream.Read(buffer, 0, buffer.Length);
				if (bytesRead == 0)
				//writing in the snapshot
			//closing the streams
			//destroying th file handle



The question is, when I pass the path of my Snapshot volume to winhttrack an
error occurs: "Directory not exists" or "Wrong argument"

The arguments is:
httrack <> -O "\\?\SnapShot0\MyWebSite"

I think I can use an httrack module using the function 
"filesave2" and use "CreateFileA" to each site file to my snapshot volume. Is
this possible, and... I can use dev-c++ to compile the module?

All articles

Subject Author Date
snapshot volume/shadow volume with httrack

03/28/2010 16:41
Re: snapshot volume/shadow volume with httrack

03/30/2010 14:26


Created with FORUM 2.0.11