/*
 * Copyright (c) 2006 Tom N Harris.
 *
 *     This program is free software; you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation; either version 2 of the License, or
 *     (at your option) any later version.
 *
 *     A copy of the GNU General Public License can be found at
 *     http://www.gnu.org/
 *
 * Written by Tom N Harris <telliamed@whoopdedo.org>.
 *
 */

#ifndef SETUP_RESTORE_H
#define SETUP_RESTORE_H

#include "win32.h"
#include "cString.h"

#include "ZipArchive.h"

namespace Setup
{

using zLib::UnzipArchive;

class Restore
{
public:
	Restore(String const& fname);
	~Restore();

	void Close(void);

	bool CopyToDest(String const& dest);
	bool CopyFileToDest(String const& dest, String const& fname);

private:
	
	bool OpenArchive(void);
	int UnzipFileToDest(String const& dest);

	void SetFileInfo(HANDLE fh, LPFILETIME mt, LPFILETIME at, LPFILETIME ct);
	void UnzipFileTimes(LPFILETIME mt, LPFILETIME at, LPFILETIME ct);
	void SetFileSD(String const& fname, char* psd);
	char* UnzipFileSD(unsigned long *plength);
	
	String m_dir;
	String m_filename;

	UnzipArchive* m_archive;
};

};

#endif
