EDN Admin
Well-known member
<br/>
By using the below sample code, tried to extract a zip file having size more than 2.5 GB(contains 6 folders in it). But the get_count is returning only 3 as number of files in it and extracting only 3 files. Can anyone please through some light here or suggest
any other VC++ or C++ library for zip file( size greater than 2GB) decompression. Thanks in advance.<br/>
<br/>
bool Unzip2Folder( BSTR lpZipFile, BSTR lpFolder)<br/>
{<br/>
<span style="white-spacere IShellDispatch *pISD;<br/>
<br/>
<span style="white-spacere Folder *pZippedFile = 0L;<br/>
<span style="white-spacere Folder *pDestination = 0L;<br/>
<br/>
<span style="white-spacere long FilesCount = 0;<br/>
<span style="white-spacere IDispatch* pItem = 0L;<br/>
<span style="white-spacere FolderItems *pFilesInside = 0L;<br/>
<br/>
<span style="white-spacere VARIANT Options, OutFolder, InZipFile, Item;<br/>
<span style="white-spacere CoInitialize( NULL);<br/>
<span style="white-spacere __try{<br/>
<span style="white-spacere if (CoCreateInstance(CLSID_Shell, NULL, CLSCTX_INPROC_SERVER, IID_IShellDispatch, (void **)&pISD) != S_OK)<br/>
<span style="white-spacere return 1;<br/>
<br/>
<span style="white-spacere InZipFile.vt = VT_BSTR;<br/>
<span style="white-spacere InZipFile.bstrVal = lpZipFile;<br/>
<span style="white-spacere pISD->NameSpace( InZipFile, &pZippedFile);<br/>
<span style="white-spacere if (!pZippedFile)<br/>
<span style="white-spacere {<br/>
<span style="white-spacere pISD->Release();<br/>
<span style="white-spacere return 1;<br/>
<span style="white-spacere }<br/>
<br/>
<span style="white-spacere OutFolder.vt = VT_BSTR;<br/>
<span style="white-spacere OutFolder.bstrVal = lpFolder;<br/>
<span style="white-spacere pISD->NameSpace( OutFolder, &pDestination);<br/>
<span style="white-spacere if(!pDestination)<br/>
<span style="white-spacere {<br/>
<span style="white-spacere pZippedFile->Release();<br/>
<span style="white-spacere pISD->Release();<br/>
<span style="white-spacere return 1;<br/>
<span style="white-spacere }<br/>
<br/>
<span style="white-spacere pZippedFile->Items(&pFilesInside);<br/>
<span style="white-spacere if(!pFilesInside)<br/>
<span style="white-spacere {<br/>
<span style="white-spacere pDestination->Release();<br/>
<span style="white-spacere pZippedFile->Release();<br/>
<span style="white-spacere pISD->Release();<br/>
<span style="white-spacere return 1;<br/>
<span style="white-spacere }<br/>
<span style="white-spacere <br/>
<span style="white-spacere pFilesInside->get_Count( &FilesCount);<br/>
<span style="white-spacere if( FilesCount < 1)<br/>
<span style="white-spacere {<br/>
<span style="white-spacere pFilesInside->Release();<br/>
<span style="white-spacere pDestination->Release();<br/>
<span style="white-spacere pZippedFile->Release();<br/>
<span style="white-spacere pISD->Release();<br/>
<span style="white-spacere return 0;<br/>
<span style="white-spacere }<br/>
<br/>
<span style="white-spacere pFilesInside->QueryInterface(IID_IDispatch,(void**)&pItem);<br/>
<br/>
<span style="white-spacere Item.vt = VT_DISPATCH;<br/>
<span style="white-spacere Item.pdispVal = pItem;<br/>
<br/>
<span style="white-spacere Options.vt = VT_I4;<br/>
<span style="white-spacere Options.lVal = 1024 | 512 | 16 | 4;//http://msdn.microsoft.com/en-us/library/bb787866(VS.85).aspx<br/>
<br/>
<span style="white-spacere bool retval = pDestination->CopyHere( Item, Options) == S_OK;<br/>
<br/>
<span style="white-spacere pItem->Release();pItem = 0L;<br/>
<span style="white-spacere pFilesInside->Release();pFilesInside = 0L;<br/>
<span style="white-spacere pDestination->Release();pDestination = 0L;<br/>
<span style="white-spacere pZippedFile->Release();pZippedFile = 0L;<br/>
<span style="white-spacere pISD->Release();pISD = 0L;<br/>
<br/>
<span style="white-spacere return retval;<br/>
<br/>
<span style="white-spacere }__finally <br/>
<span style="white-spacere {<br/>
<span style="white-spacere CoUninitialize();<br/>
<span style="white-spacere }<br/>
}
View the full article
By using the below sample code, tried to extract a zip file having size more than 2.5 GB(contains 6 folders in it). But the get_count is returning only 3 as number of files in it and extracting only 3 files. Can anyone please through some light here or suggest
any other VC++ or C++ library for zip file( size greater than 2GB) decompression. Thanks in advance.<br/>
<br/>
bool Unzip2Folder( BSTR lpZipFile, BSTR lpFolder)<br/>
{<br/>
<span style="white-spacere IShellDispatch *pISD;<br/>
<br/>
<span style="white-spacere Folder *pZippedFile = 0L;<br/>
<span style="white-spacere Folder *pDestination = 0L;<br/>
<br/>
<span style="white-spacere long FilesCount = 0;<br/>
<span style="white-spacere IDispatch* pItem = 0L;<br/>
<span style="white-spacere FolderItems *pFilesInside = 0L;<br/>
<br/>
<span style="white-spacere VARIANT Options, OutFolder, InZipFile, Item;<br/>
<span style="white-spacere CoInitialize( NULL);<br/>
<span style="white-spacere __try{<br/>
<span style="white-spacere if (CoCreateInstance(CLSID_Shell, NULL, CLSCTX_INPROC_SERVER, IID_IShellDispatch, (void **)&pISD) != S_OK)<br/>
<span style="white-spacere return 1;<br/>
<br/>
<span style="white-spacere InZipFile.vt = VT_BSTR;<br/>
<span style="white-spacere InZipFile.bstrVal = lpZipFile;<br/>
<span style="white-spacere pISD->NameSpace( InZipFile, &pZippedFile);<br/>
<span style="white-spacere if (!pZippedFile)<br/>
<span style="white-spacere {<br/>
<span style="white-spacere pISD->Release();<br/>
<span style="white-spacere return 1;<br/>
<span style="white-spacere }<br/>
<br/>
<span style="white-spacere OutFolder.vt = VT_BSTR;<br/>
<span style="white-spacere OutFolder.bstrVal = lpFolder;<br/>
<span style="white-spacere pISD->NameSpace( OutFolder, &pDestination);<br/>
<span style="white-spacere if(!pDestination)<br/>
<span style="white-spacere {<br/>
<span style="white-spacere pZippedFile->Release();<br/>
<span style="white-spacere pISD->Release();<br/>
<span style="white-spacere return 1;<br/>
<span style="white-spacere }<br/>
<br/>
<span style="white-spacere pZippedFile->Items(&pFilesInside);<br/>
<span style="white-spacere if(!pFilesInside)<br/>
<span style="white-spacere {<br/>
<span style="white-spacere pDestination->Release();<br/>
<span style="white-spacere pZippedFile->Release();<br/>
<span style="white-spacere pISD->Release();<br/>
<span style="white-spacere return 1;<br/>
<span style="white-spacere }<br/>
<span style="white-spacere <br/>
<span style="white-spacere pFilesInside->get_Count( &FilesCount);<br/>
<span style="white-spacere if( FilesCount < 1)<br/>
<span style="white-spacere {<br/>
<span style="white-spacere pFilesInside->Release();<br/>
<span style="white-spacere pDestination->Release();<br/>
<span style="white-spacere pZippedFile->Release();<br/>
<span style="white-spacere pISD->Release();<br/>
<span style="white-spacere return 0;<br/>
<span style="white-spacere }<br/>
<br/>
<span style="white-spacere pFilesInside->QueryInterface(IID_IDispatch,(void**)&pItem);<br/>
<br/>
<span style="white-spacere Item.vt = VT_DISPATCH;<br/>
<span style="white-spacere Item.pdispVal = pItem;<br/>
<br/>
<span style="white-spacere Options.vt = VT_I4;<br/>
<span style="white-spacere Options.lVal = 1024 | 512 | 16 | 4;//http://msdn.microsoft.com/en-us/library/bb787866(VS.85).aspx<br/>
<br/>
<span style="white-spacere bool retval = pDestination->CopyHere( Item, Options) == S_OK;<br/>
<br/>
<span style="white-spacere pItem->Release();pItem = 0L;<br/>
<span style="white-spacere pFilesInside->Release();pFilesInside = 0L;<br/>
<span style="white-spacere pDestination->Release();pDestination = 0L;<br/>
<span style="white-spacere pZippedFile->Release();pZippedFile = 0L;<br/>
<span style="white-spacere pISD->Release();pISD = 0L;<br/>
<br/>
<span style="white-spacere return retval;<br/>
<br/>
<span style="white-spacere }__finally <br/>
<span style="white-spacere {<br/>
<span style="white-spacere CoUninitialize();<br/>
<span style="white-spacere }<br/>
}
View the full article