Fix crash if a valid minidump is residing in minidumps folder.

This commit is contained in:
/dev/urandom 2016-08-28 22:47:22 +02:00
parent f9e2eeca7b
commit 531fdf0e34
No known key found for this signature in database
GPG Key ID: 41322B973E0F295E

View File

@ -26,7 +26,7 @@ namespace Components
std::string Minidump::ToString() std::string Minidump::ToString()
{ {
if (!Minidump::EnsureFileMapping()) return false; if (!this->EnsureFileMapping()) return false;
auto pBuf = MapViewOfFile(this->mapFileHandle, FILE_MAP_READ, 0, 0, 0); auto pBuf = MapViewOfFile(this->mapFileHandle, FILE_MAP_READ, 0, 0, 0);
if (pBuf == NULL) if (pBuf == NULL)
@ -48,7 +48,7 @@ namespace Components
bool Minidump::GetStream(MINIDUMP_STREAM_TYPE type, PMINIDUMP_DIRECTORY* directoryPtr, PVOID* streamBeginningPtr, ULONG* streamSizePtr) bool Minidump::GetStream(MINIDUMP_STREAM_TYPE type, PMINIDUMP_DIRECTORY* directoryPtr, PVOID* streamBeginningPtr, ULONG* streamSizePtr)
{ {
if (!Minidump::EnsureFileMapping()) return false; if (!this->EnsureFileMapping()) return false;
auto pBuf = MapViewOfFile(this->mapFileHandle, FILE_MAP_READ, 0, 0, 0); auto pBuf = MapViewOfFile(this->mapFileHandle, FILE_MAP_READ, 0, 0, 0);
if (pBuf == NULL) if (pBuf == NULL)
@ -110,7 +110,7 @@ namespace Components
if (this->mapFileHandle == NULL || this->mapFileHandle == INVALID_HANDLE_VALUE) if (this->mapFileHandle == NULL || this->mapFileHandle == INVALID_HANDLE_VALUE)
{ {
this->mapFileHandle = CreateFileMappingA(this->fileHandle, NULL, PAGE_READONLY, 0, 0, NULL); this->mapFileHandle = CreateFileMappingA(this->fileHandle, NULL, PAGE_READONLY, 0, 0, NULL);
if (this->mapFileHandle == NULL || this->mapFileHandle == INVALID_HANDLE_VALUE) if (this->mapFileHandle == NULL)
{ {
Utils::OutputDebugLastError(); Utils::OutputDebugLastError();
return false; return false;