seems that we can't MapViewOfFile big images , return an error in failure
This commit is contained in:
parent
e22e99a9db
commit
c328fc6fe4
|
@ -54,6 +54,11 @@ bool PKG::extract(const std::string& filepath, const std::string& extractPath, s
|
||||||
}
|
}
|
||||||
file.Seek(0, fsSeekSet);
|
file.Seek(0, fsSeekSet);
|
||||||
pkg = (U08*)mmap(pkgSize, file.fileDescr());
|
pkg = (U08*)mmap(pkgSize, file.fileDescr());
|
||||||
|
if (pkg == nullptr)
|
||||||
|
{
|
||||||
|
failreason = "Can't allocate size for image";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
file.Read(pkg, pkgSize);
|
file.Read(pkg, pkgSize);
|
||||||
|
|
||||||
|
|
|
@ -135,6 +135,10 @@ public:
|
||||||
if (hHandle != NULL) {
|
if (hHandle != NULL) {
|
||||||
pStart = MapViewOfFile(hHandle, FILE_MAP_COPY, 0, 0, sLength);
|
pStart = MapViewOfFile(hHandle, FILE_MAP_COPY, 0, 0, sLength);
|
||||||
}
|
}
|
||||||
|
if(pStart == NULL)
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
return pStart;
|
return pStart;
|
||||||
}
|
}
|
||||||
int munmap(void* pStart) {
|
int munmap(void* pStart) {
|
||||||
|
|
Loading…
Reference in New Issue