Exemplo n.º 1
0
	// Extract additional files from the CAB file which has been used in a previous call to ExtractUrlW()
	BOOL ExtractMoreUrlW(const CStrW& sw_TargetDir, void* pParam = NULL)
	{
		mu32_Cache = 0;
		// re-open the same connection, re-using the cache's contents or the already downloaded file
		BOOL  b_Offline;
		DWORD u32_ApiErr = mi_Internet.ConnectServer(&b_Offline);
		if (u32_ApiErr)
		{
			if (b_Offline) mi_Error.Set(FDIERROR_MSIE_OFFLINE, u32_ApiErr, 0);
			else           mi_Error.Set(FDIERROR_INTERNET,     u32_ApiErr, 0);
			return FALSE;
		}
		return ExtractFileW(L"*CABINET\\*URL", sw_TargetDir, pParam);
	}
Exemplo 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);
	}
Exemplo n.º 3
0
	// Copy the files from the stream which contains a cabinet file
	BOOL ExtractStreamW(CStrW sw_TargetDir, void* pParam = NULL)
	{
		// Pass it on to the base class (the file name is a dummy which is not used)
		return ExtractFileW(L"*CABINET\\*STREAM", sw_TargetDir, pParam);
	}
 BOOL ExtractResourceW(const CStrW& sw_Module, const CStrW& sw_ResName, const CStrW& sw_ResType, const CStrW& sw_TargetDir, void * pParam = NULL)
 {
     mk_Resource.Set(sw_Module, sw_ResName, 0, sw_ResType, 0);
     return ExtractFileW(L"*CABINET\\*RESOURCE", sw_TargetDir, pParam);
 }
 // Copy the content of the cabinet in the resources to disk
 // You can set sw_Module = "" if the cabinet is in the EXE file which created the process
 // Otherwise sw_Module must be the filename (without path) of the DLL which contains the CAB resource
 // To test this function with the file Test.cab included in this project
 // set sw_Module = "" and u32_ResID = ID_CAB_TEST and sw_ResType = "CABFILE"
 // because the file Cabinet.rc contains:
 // ID_CAB_TEST        CABFILE         "Res\\Test.cab"
 BOOL ExtractResourceW(const CStrW& sw_Module, UINT u32_ResID, UINT u32_ResType, const CStrW& sw_TargetDir, void * pParam = NULL)
 {
     mk_Resource.Set(sw_Module, L"", u32_ResID, L"", u32_ResType);
     return ExtractFileW(L"*CABINET\\*RESOURCE", sw_TargetDir, pParam);
 }