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

Function ProcessFile

Libraries/unrar/dll.cpp:325–417  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

323
324
325int PASCAL ProcessFile(HANDLE hArcData,int Operation,char *DestPath,char *DestName,wchar *DestPathW,wchar *DestNameW)
326{
327 DataSet *Data=(DataSet *)hArcData;
328 try
329 {
330 Data->Cmd.DllError=0;
331 if (Data->OpenMode==RAR_OM_LIST || Data->OpenMode==RAR_OM_LIST_INCSPLIT ||
332 Operation==RAR_SKIP && !Data->Arc.Solid)
333 {
334 if (Data->Arc.Volume && Data->Arc.GetHeaderType()==HEAD_FILE &&
335 Data->Arc.FileHead.SplitAfter)
336 if (MergeArchive(Data->Arc,NULL,false,'L'))
337 {
338 Data->Arc.Seek(Data->Arc.CurBlockPos,SEEK_SET);
339 return ERAR_SUCCESS;
340 }
341 else
342 return ERAR_EOPEN;
343 Data->Arc.SeekToNext();
344 }
345 else
346 {
347 Data->Cmd.DllOpMode=Operation;
348
349 *Data->Cmd.ExtrPath=0;
350 *Data->Cmd.DllDestName=0;
351
352 if (DestPath!=NULL)
353 {
354 char ExtrPathA[NM];
355 strncpyz(ExtrPathA,DestPath,ASIZE(ExtrPathA)-2);
356#ifdef _WIN_ALL
357 // We must not apply OemToCharBuffA directly to DestPath,
358 // because we do not know DestPath length and OemToCharBuffA
359 // does not stop at 0.
360 OemToCharA(ExtrPathA,ExtrPathA);
361#endif
362 CharToWide(ExtrPathA,Data->Cmd.ExtrPath,ASIZE(Data->Cmd.ExtrPath));
363 AddEndSlash(Data->Cmd.ExtrPath,ASIZE(Data->Cmd.ExtrPath));
364 }
365 if (DestName!=NULL)
366 {
367 char DestNameA[NM];
368 strncpyz(DestNameA,DestName,ASIZE(DestNameA)-2);
369#ifdef _WIN_ALL
370 // We must not apply OemToCharBuffA directly to DestName,
371 // because we do not know DestName length and OemToCharBuffA
372 // does not stop at 0.
373 OemToCharA(DestNameA,DestNameA);
374#endif
375 CharToWide(DestNameA,Data->Cmd.DllDestName,ASIZE(Data->Cmd.DllDestName));
376 }
377
378 if (DestPathW!=NULL)
379 {
380 wcsncpy(Data->Cmd.ExtrPath,DestPathW,ASIZE(Data->Cmd.ExtrPath));
381 AddEndSlash(Data->Cmd.ExtrPath,ASIZE(Data->Cmd.ExtrPath));
382 }

Callers 2

RARProcessFileFunction · 0.85
RARProcessFileWFunction · 0.85

Calls 12

MergeArchiveFunction · 0.85
strncpyzFunction · 0.85
CharToWideFunction · 0.85
AddEndSlashFunction · 0.85
wcsncpyzFunction · 0.85
RarErrorToDllFunction · 0.85
GetHeaderTypeMethod · 0.80
SeekToNextMethod · 0.80
ExtractCurrentFileMethod · 0.80
IsOpenedMethod · 0.80
SeekMethod · 0.45
ReadHeaderMethod · 0.45

Tested by

no test coverage detected