Ejemplo n.º 1
0
	// CleanUp() must only be called if this class is not destroyed with its destructor
	// It must be called to close the connection to the server and close the download file which is still open
	// This is NOT done automatically to allow re-using this class (e.g. multiple extraction of single files)
	BOOL CleanUp()
	{
		mi_Internet.CleanUp();       // close handles
		mi_FirstBlock.Init(0,0,0,0); // free memory
		mi_Cache[0].Init  (0,0,0);
		mi_Cache[1].Init  (0,0,0);
		
		// Clean up base class
		return CExtract::CleanUp();
	}
Ejemplo n.º 2
0
	// Extract the CAB file at the given URL into the given target directory
	// If u16_LocalFile = ""  -> a temporary file will be created
	// A Cabfile will be written to disk ONLY if u32_Blocksize = 0 !!
	// u16_TargetDir = L"" AND Blocksize = 0 --> only download any file from internet to disk
	BOOL ExtractUrlW(const CStrW& sw_URL, DWORD u32_Blocksize, const CStrW& sw_LocalFile, const CStrW& sw_TargetDir, void* pParam = NULL)
	{
		if (!Initialize(sw_URL, sw_LocalFile, u32_Blocksize))
			return FALSE;

		// Just a download without CAB extraction
		if (!u32_Blocksize && sw_LocalFile.Len() && !sw_TargetDir.Len())
		{
			// The caller may want to access the file immediately -> close all
			mi_Internet.CleanUp();
			return TRUE;
		}

		// Pass it on to the base class
		return ExtractFileW(L"*CABINET\\*URL", sw_TargetDir, pParam);
	}