MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / ReadHeaderEx

Function ReadHeaderEx

apps/tools/TcPbo/tc_pbo.cpp:251–275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249 }
250
251 int __stdcall ReadHeaderEx(WCX_HANDLE hArcData, tHeaderDataEx* HeaderData)
252 {
253 auto* arc = reinterpret_cast<PboArchive*>(hArcData);
254 if (!arc || arc->currentIndex >= static_cast<int>(arc->entries.size()))
255 return E_END_ARCHIVE;
256
257 const auto& e = arc->entries[arc->currentIndex];
258 memset(HeaderData, 0, sizeof(tHeaderDataEx));
259 strncpy(HeaderData->ArcName, arc->archiveName.c_str(), sizeof(HeaderData->ArcName) - 1);
260
261 std::string name = e.name;
262 NormalizePathSeparators(name);
263 strncpy(HeaderData->FileName, name.c_str(), sizeof(HeaderData->FileName) - 1);
264
265 bool compressed = (e.compressedMagic == CompMagic);
266 HeaderData->PackSize = static_cast<unsigned int>(e.length);
267 HeaderData->PackSizeHigh = 0;
268 HeaderData->UnpSize =
269 compressed ? static_cast<unsigned int>(e.uncompressedSize) : static_cast<unsigned int>(e.length);
270 HeaderData->UnpSizeHigh = 0;
271 HeaderData->FileTime = UnixTimeToDos(e.time);
272 HeaderData->FileAttr = FILE_ATTRIBUTE_NORMAL;
273
274 return 0;
275 }
276
277 int __stdcall ProcessFile(WCX_HANDLE hArcData, int Operation, char* DestPath, char* DestName)
278 {

Callers

nothing calls this directly

Calls 3

NormalizePathSeparatorsFunction · 0.85
UnixTimeToDosFunction · 0.85
sizeMethod · 0.80

Tested by

no test coverage detected