Probllem extracting Zip files greater than 2 GB size

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<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-space:pre IShellDispatch *pISD;<br/>
<br/>
<span style="white-space:pre Folder *pZippedFile = 0L;<br/>
<span style="white-space:pre Folder *pDestination = 0L;<br/>
<br/>
<span style="white-space:pre long FilesCount = 0;<br/>
<span style="white-space:pre IDispatch* pItem = 0L;<br/>
<span style="white-space:pre FolderItems *pFilesInside = 0L;<br/>
<br/>
<span style="white-space:pre VARIANT Options, OutFolder, InZipFile, Item;<br/>
<span style="white-space:pre CoInitialize( NULL);<br/>
<span style="white-space:pre __try{<br/>
<span style="white-space:pre if (CoCreateInstance(CLSID_Shell, NULL, CLSCTX_INPROC_SERVER, IID_IShellDispatch, (void **)&pISD) != S_OK)<br/>
<span style="white-space:pre return 1;<br/>
<br/>
<span style="white-space:pre InZipFile.vt = VT_BSTR;<br/>
<span style="white-space:pre InZipFile.bstrVal = lpZipFile;<br/>
<span style="white-space:pre pISD->NameSpace( InZipFile, &pZippedFile);<br/>
<span style="white-space:pre if (!pZippedFile)<br/>
<span style="white-space:pre {<br/>
<span style="white-space:pre pISD->Release();<br/>
<span style="white-space:pre return 1;<br/>
<span style="white-space:pre }<br/>
<br/>
<span style="white-space:pre OutFolder.vt = VT_BSTR;<br/>
<span style="white-space:pre OutFolder.bstrVal = lpFolder;<br/>
<span style="white-space:pre pISD->NameSpace( OutFolder, &pDestination);<br/>
<span style="white-space:pre if(!pDestination)<br/>
<span style="white-space:pre {<br/>
<span style="white-space:pre pZippedFile->Release();<br/>
<span style="white-space:pre pISD->Release();<br/>
<span style="white-space:pre return 1;<br/>
<span style="white-space:pre }<br/>
<br/>
<span style="white-space:pre pZippedFile->Items(&pFilesInside);<br/>
<span style="white-space:pre if(!pFilesInside)<br/>
<span style="white-space:pre {<br/>
<span style="white-space:pre pDestination->Release();<br/>
<span style="white-space:pre pZippedFile->Release();<br/>
<span style="white-space:pre pISD->Release();<br/>
<span style="white-space:pre return 1;<br/>
<span style="white-space:pre }<br/>
<span style="white-space:pre <br/>
<span style="white-space:pre pFilesInside->get_Count( &FilesCount);<br/>
<span style="white-space:pre if( FilesCount < 1)<br/>
<span style="white-space:pre {<br/>
<span style="white-space:pre pFilesInside->Release();<br/>
<span style="white-space:pre pDestination->Release();<br/>
<span style="white-space:pre pZippedFile->Release();<br/>
<span style="white-space:pre pISD->Release();<br/>
<span style="white-space:pre return 0;<br/>
<span style="white-space:pre }<br/>
<br/>
<span style="white-space:pre pFilesInside->QueryInterface(IID_IDispatch,(void**)&pItem);<br/>
<br/>
<span style="white-space:pre Item.vt = VT_DISPATCH;<br/>
<span style="white-space:pre Item.pdispVal = pItem;<br/>
<br/>
<span style="white-space:pre Options.vt = VT_I4;<br/>
<span style="white-space:pre Options.lVal = 1024 | 512 | 16 | 4;//http://msdn.microsoft.com/en-us/library/bb787866(VS.85).aspx<br/>
<br/>
<span style="white-space:pre bool retval = pDestination->CopyHere( Item, Options) == S_OK;<br/>
<br/>
<span style="white-space:pre pItem->Release();pItem = 0L;<br/>
<span style="white-space:pre pFilesInside->Release();pFilesInside = 0L;<br/>
<span style="white-space:pre pDestination->Release();pDestination = 0L;<br/>
<span style="white-space:pre pZippedFile->Release();pZippedFile = 0L;<br/>
<span style="white-space:pre pISD->Release();pISD = 0L;<br/>
<br/>
<span style="white-space:pre return retval;<br/>
<br/>
<span style="white-space:pre }__finally <br/>
<span style="white-space:pre {<br/>
<span style="white-space:pre CoUninitialize();<br/>
<span style="white-space:pre }<br/>
}

View the full article
 
Back
Top