MCPcopy Create free account
hub / github.com/abbeycode/UnrarKit / UnpWrite

Method UnpWrite

Libraries/unrar/rdwrfn.cpp:158–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156#endif
157
158void ComprDataIO::UnpWrite(byte *Addr,size_t Count)
159{
160
161#ifdef RARDLL
162 RAROptions *Cmd=((Archive *)SrcFile)->GetRAROptions();
163 if (Cmd->DllOpMode!=RAR_SKIP)
164 {
165 if (Cmd->Callback!=NULL &&
166 Cmd->Callback(UCM_PROCESSDATA,Cmd->UserData,(LPARAM)Addr,Count)==-1)
167 ErrHandler.Exit(RARX_USERBREAK);
168 if (Cmd->ProcessDataProc!=NULL)
169 {
170 // Here we preserve ESP value. It is necessary for those developers,
171 // who still define ProcessDataProc callback as "C" type function,
172 // even though in year 2001 we announced in unrar.dll whatsnew.txt
173 // that it will be PASCAL type (for compatibility with Visual Basic).
174#if defined(_MSC_VER)
175#ifndef _WIN_64
176 __asm mov ebx,esp
177#endif
178#elif defined(_WIN_ALL) && defined(__BORLANDC__)
179 _EBX=_ESP;
180#endif
181 int RetCode=Cmd->ProcessDataProc(Addr,(int)Count);
182
183 // Restore ESP after ProcessDataProc with wrongly defined calling
184 // convention broken it.
185#if defined(_MSC_VER)
186#ifndef _WIN_64
187 __asm mov esp,ebx
188#endif
189#elif defined(_WIN_ALL) && defined(__BORLANDC__)
190 _ESP=_EBX;
191#endif
192 if (RetCode==0)
193 ErrHandler.Exit(RARX_USERBREAK);
194 }
195 }
196#endif // RARDLL
197
198 UnpWrAddr=Addr;
199 UnpWrSize=Count;
200 if (UnpackToMemory)
201 {
202 if (Count <= UnpackToMemorySize)
203 {
204 memcpy(UnpackToMemoryAddr,Addr,Count);
205 UnpackToMemoryAddr+=Count;
206 UnpackToMemorySize-=Count;
207 }
208 }
209 else
210 if (!TestMode)
211 DestFile->Write(Addr,Count);
212 CurUnpWrite+=Count;
213 if (!SkipUnpCRC)
214 UnpHash.Update(Addr,Count);
215 ShowUnpWrite();

Callers 5

UnpWriteBufMethod · 0.80
UnpWriteDataMethod · 0.80
UnpWriteBuf30Method · 0.80
UnstoreFileMethod · 0.80
UnpWriteBuf20Method · 0.80

Calls 5

WaitFunction · 0.85
GetRAROptionsMethod · 0.80
ExitMethod · 0.80
WriteMethod · 0.80
UpdateMethod · 0.45

Tested by

no test coverage detected