mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-03 05:57:40 -05:00
impr: General code cleanup
This commit is contained in:
@@ -31,10 +31,10 @@ namespace hex::plugin::windows {
|
||||
}
|
||||
|
||||
void ProcessMemoryProvider::readRaw(u64 address, void *buffer, size_t size) {
|
||||
ReadProcessMemory(this->m_processHandle, (LPCVOID)address, buffer, size, nullptr);
|
||||
ReadProcessMemory(this->m_processHandle, reinterpret_cast<LPCVOID>(address), buffer, size, nullptr);
|
||||
}
|
||||
void ProcessMemoryProvider::writeRaw(u64 address, const void *buffer, size_t size) {
|
||||
WriteProcessMemory(this->m_processHandle, (LPVOID)address, buffer, size, nullptr);
|
||||
WriteProcessMemory(this->m_processHandle, reinterpret_cast<LPVOID>(address), buffer, size, nullptr);
|
||||
}
|
||||
|
||||
std::pair<Region, bool> ProcessMemoryProvider::getRegionValidity(u64 address) const {
|
||||
@@ -114,7 +114,7 @@ namespace hex::plugin::windows {
|
||||
for (auto &pixel : pixels)
|
||||
pixel = (pixel & 0xFF00FF00) | ((pixel & 0xFF) << 16) | ((pixel & 0xFF0000) >> 16);
|
||||
|
||||
texture = ImGui::Texture((u8*)pixels.data(), pixels.size(), bitmap.bmWidth, bitmap.bmHeight);
|
||||
texture = ImGui::Texture(reinterpret_cast<u8*>(pixels.data()), pixels.size(), bitmap.bmWidth, bitmap.bmHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,7 @@ namespace hex::plugin::windows {
|
||||
}
|
||||
}
|
||||
|
||||
this->m_processes.push_back({ processId, processName, std::move(texture) });
|
||||
this->m_processes.push_back(Process { u32(processId), processName, std::move(texture) });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ namespace hex::plugin::windows {
|
||||
|
||||
MEMORY_BASIC_INFORMATION memoryInfo;
|
||||
for (u64 address = 0; address < this->getActualSize(); address += memoryInfo.RegionSize) {
|
||||
if (VirtualQueryEx(this->m_processHandle, (LPCVOID)address, &memoryInfo, sizeof(MEMORY_BASIC_INFORMATION)) == 0)
|
||||
if (VirtualQueryEx(this->m_processHandle, reinterpret_cast<LPCVOID>(address), &memoryInfo, sizeof(MEMORY_BASIC_INFORMATION)) == 0)
|
||||
break;
|
||||
|
||||
std::string name;
|
||||
@@ -270,7 +270,7 @@ namespace hex::plugin::windows {
|
||||
if (memoryInfo.State & MEM_PRIVATE) name += hex::format("{} ", "hex.windows.provider.process_memory.region.private"_lang);
|
||||
if (memoryInfo.State & MEM_MAPPED) name += hex::format("{} ", "hex.windows.provider.process_memory.region.mapped"_lang);
|
||||
|
||||
this->m_memoryRegions.insert({ { (u64)memoryInfo.BaseAddress, (u64)memoryInfo.BaseAddress + memoryInfo.RegionSize }, name });
|
||||
this->m_memoryRegions.insert({ { u64(memoryInfo.BaseAddress), u64(memoryInfo.BaseAddress) + memoryInfo.RegionSize }, name });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/imhex_api.hpp>
|
||||
|
||||
#include <hex/helpers/fmt.hpp>
|
||||
#include <hex/api/localization.hpp>
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <hex/ui/imgui_imhex_extensions.h>
|
||||
|
||||
#include <fonts/fontawesome_font.h>
|
||||
#include <fonts/codicons_font.h>
|
||||
|
||||
namespace hex::plugin::windows {
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace hex::plugin::windows {
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
std::vector<std::pair<std::string, std::string>> ViewTTYConsole::getAvailablePorts() {
|
||||
std::vector<std::pair<std::string, std::string>> ViewTTYConsole::getAvailablePorts() const {
|
||||
std::vector<std::pair<std::string, std::string>> result;
|
||||
std::vector<char> buffer(0xFFF, 0x00);
|
||||
|
||||
@@ -273,8 +273,7 @@ namespace hex::plugin::windows {
|
||||
}
|
||||
} else {
|
||||
byte = 0;
|
||||
auto res = ::WaitForSingleObject(overlapped.hEvent, 500);
|
||||
switch (res) {
|
||||
switch (::WaitForSingleObject(overlapped.hEvent, 500)) {
|
||||
case WAIT_OBJECT_0:
|
||||
if (::GetOverlappedResult(this->m_portHandle, &overlapped, &bytesRead, false)) {
|
||||
addByte(byte);
|
||||
|
||||
Reference in New Issue
Block a user