Skip to content

Commit

Permalink
[REFACT] Added missing type cast. More detailed logging
Browse files Browse the repository at this point in the history
  • Loading branch information
hasherezade committed Jun 1, 2024
1 parent 27e8c96 commit a2585f0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions scanners/mempage_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ bool pesieve::MemPageData::loadModuleName()
std::string module_name = RemoteModuleData::getModuleName(processHandle, mod_base);
if (module_name.length() == 0) {
#ifdef _DEBUG
std::cerr << "Could not retrieve module name" << std::endl;
std::cerr << "Could not retrieve the module name. Base: " << std::hex << mod_base << std::endl;
#endif
return false;
}
Expand All @@ -49,7 +49,7 @@ bool pesieve::MemPageData::loadMappedName()
std::string mapped_filename = RemoteModuleData::getMappedName(this->processHandle, (HMODULE)this->alloc_base);
if (mapped_filename.length() == 0) {
#ifdef _DEBUG
std::cerr << "Could not retrieve name" << std::endl;
std::cerr << "Could not retrieve the mapped name. Base: " << std::hex << this->alloc_base << std::endl;
#endif
return false;
}
Expand Down
5 changes: 4 additions & 1 deletion scanners/module_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ bool pesieve::ModulesCache::isCacheAvailable(const size_t neededSize)
DWORD info = 0;

if (!GetProcessWorkingSetSizeEx(GetCurrentProcess(), &minSize, &maxSize, &info)) {
#ifdef _DEBUG
std::cout << "GetProcessWorkingSetSizeEx failed!\n";
#endif
return false;
}

Expand All @@ -65,7 +68,7 @@ bool pesieve::ModulesCache::isCacheAvailable(const size_t neededSize)

if ((info & QUOTA_LIMITS_HARDWS_MAX_DISABLE) == QUOTA_LIMITS_HARDWS_MAX_DISABLE) { // The working set may exceed the maximum working set limit if there is abundant memory
if (GlobalMemoryStatusEx(&memStatus)) {
if (memStatus.ullAvailVirtual > (neededSize * 2) && (memStatus.dwMemoryLoad < 50)) {
if (memStatus.ullAvailVirtual > ((DWORDLONG)neededSize * 2) && (memStatus.dwMemoryLoad < 50)) {
hasFree = true;
}
}
Expand Down

0 comments on commit a2585f0

Please sign in to comment.