Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -360,4 +360,7 @@ MigrationBackup/
.ionide/

# Fody - auto-generated XML schema
FodyWeavers.xsd
FodyWeavers.xsd

/Build/
*.ini
Binary file removed Build/MemoryReadProject.exe
Binary file not shown.
10 changes: 10 additions & 0 deletions MemoryReadProject.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ VisualStudioVersion = 17.9.34728.123
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MemoryReadProject", "MemoryReadProject\MemoryReadProject.vcxproj", "{9C800F96-AE23-4E5B-80F9-BE36A1631A1A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Test", "Test\Test.vcxproj", "{068A6D2C-1986-435F-B067-455FC8A0BD12}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Expand All @@ -21,6 +23,14 @@ Global
{9C800F96-AE23-4E5B-80F9-BE36A1631A1A}.Release|x64.Build.0 = Release|x64
{9C800F96-AE23-4E5B-80F9-BE36A1631A1A}.Release|x86.ActiveCfg = Release|Win32
{9C800F96-AE23-4E5B-80F9-BE36A1631A1A}.Release|x86.Build.0 = Release|Win32
{068A6D2C-1986-435F-B067-455FC8A0BD12}.Debug|x64.ActiveCfg = Debug|x64
{068A6D2C-1986-435F-B067-455FC8A0BD12}.Debug|x64.Build.0 = Debug|x64
{068A6D2C-1986-435F-B067-455FC8A0BD12}.Debug|x86.ActiveCfg = Debug|Win32
{068A6D2C-1986-435F-B067-455FC8A0BD12}.Debug|x86.Build.0 = Debug|Win32
{068A6D2C-1986-435F-B067-455FC8A0BD12}.Release|x64.ActiveCfg = Release|x64
{068A6D2C-1986-435F-B067-455FC8A0BD12}.Release|x64.Build.0 = Release|x64
{068A6D2C-1986-435F-B067-455FC8A0BD12}.Release|x86.ActiveCfg = Release|Win32
{068A6D2C-1986-435F-B067-455FC8A0BD12}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
41 changes: 34 additions & 7 deletions MemoryReadProject/Include/Process.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,46 @@ using PID = DWORD;
using PROCESS = HANDLE;

struct SelectedProcess {
PID pid{ NULL };
PROCESS process {nullptr};
};
PID pid{ NULL };
PROCESS process{ nullptr };


~SelectedProcess() {
if (this->process != nullptr)
CloseHandle(this->process);
}

void openProcess();

template <typename T>
void ReadMemory(void* start, size_t size, T const &buff);

template <typename T>
void WriteMemory(void* start, size_t size, T const &buff);

};
namespace Process {
void EnableDebugPriv();

void GetAllProcess();
inline std::map<std::wstring, PID> currentsProcess;

inline SelectedProcess selectedProcess{ NULL };

void EnableDebugPriv();
//Memory Pages Info
inline std::map<int, MEMORY_BASIC_INFORMATION> currentMemoryModulesInfo;
void GetMemoryPages();
void DrawMemoryPages(const int &currentDrawPageIndex);

inline std::map<std::wstring, PID> currentsProcess;
//Modules Info
inline std::map<int, MODULEENTRY32W> currentProcessModules;
void GetModules();
void DrawModules(const int& currentDrawModuleIndex);

inline SelectedProcess selectedProcess{ NULL };
//Finded Memory
template <typename T>
inline std::map<int, T> findedCurrentProcessMemory;

void GetAllProcess();
}

//void refindBytePatternInProcessMemory(PROCESS process, void* pattern, size_t patternLen, std::vector<void*>& found)
Expand Down
16 changes: 0 additions & 16 deletions MemoryReadProject/imgui.ini

This file was deleted.

183 changes: 162 additions & 21 deletions MemoryReadProject/src/MemoryReadProject.cpp
Original file line number Diff line number Diff line change
@@ -1,56 +1,195 @@
#include "../Include/global.h"


char ProcessName[128];
int currentDrawModuleIndex{ 0 };


int FindValueIndex{ 0 };
const char* FindValueTypes[]
{
"int", "float"
};

char FindValue[60];

//template <typename T>
//GetType(const char* type) {
// switch (type)
// {
// case "int":
// return int;
//
// case "float":
// return float;
//
// default:
// break;
// }
//}

void menu() {
if (ImGui::BeginTabBar("##open selector")) {

if (ImGui::BeginTabItem("Select Process"))
{
if (ImGui::Button("Update Process List")) {
Process::GetAllProcess();
}
ImGui::InputText("Process Name", ProcessName, IM_ARRAYSIZE(ProcessName));

Process::GetAllProcess();

std::map<std::wstring, PID>::iterator it = Process::currentsProcess.begin();

ImGui::BeginChild("Process", ImVec2(500, 150));
{
while (it != Process::currentsProcess.end()) {
if (it->second == Process::selectedProcess.pid) {
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0, 1, 0, 1));
int ProcessNameCount = 0;
for (int i = 0; i < ProcessName[i] != '\0'; i++)
{
++ProcessNameCount;
}

bool print = false;
for (; it != Process::currentsProcess.end();) {
if (ProcessNameCount > 0) {
for (int i = 0; i < ProcessNameCount;) {
try
{
if (it->first[i] == ProcessName[i]) {
++i;
}
else
{
break;
}
if (i == ProcessNameCount) {
print = true;
}
}
catch (const std::exception&)
{
print = false;
break;
}
}

if (print) {
if (it->second == Process::selectedProcess.pid) {
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0, 1, 0, 1));
}
else
{
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1, 0, 0, 1));
}

ImGui::Text("ProcessName: %ls / PID: %d", it->first.c_str(), it->second);
if (ImGui::IsItemClicked()) {
Process::selectedProcess.pid = it->second;
Process::selectedProcess.openProcess();
Process::GetMemoryPages();
Process::GetModules();
}
ImGui::PopStyleColor();
print = false;
}
++it;
}
else
{
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1, 0, 0, 1));
if (it->second == Process::selectedProcess.pid) {
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0, 1, 0, 1));
}
else
{
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1, 0, 0, 1));
}

ImGui::Text("ProcessName: %ls / PID: %d", it->first.c_str(), it->second);
if (ImGui::IsItemClicked()) {
Process::selectedProcess.pid = it->second;
Process::selectedProcess.openProcess();
Process::GetMemoryPages();
Process::GetModules();
}
ImGui::PopStyleColor();
++it;
}

ImGui::Text("ProcessName: %ls / PID: %d", it->first.c_str(), it->second);

ImGui::PopStyleColor();

if (ImGui::IsItemClicked()) {
Process::selectedProcess.pid = it->second;
}
++it;
}

}ImGui::EndChild();

ImGui::EndTabItem();
}

if(ImGui::BeginTabItem("Memory")) {
if (Process::selectedProcess.pid != NULL) {
if (Process::selectedProcess.pid) {
//Memory
if (ImGui::BeginTabItem("Memory Page Info")) {
if (ImGui::Button("Update Pages")) {
Process::GetMemoryPages();
}

ImGui::Text("Memory Pages");
ImGui::BeginChild("Memory Page", ImVec2(700, 300));
{
if (currentDrawModuleIndex * 30 < Process::currentMemoryModulesInfo.size()) {
for (int i = currentDrawModuleIndex * 30, count = 0;
i < Process::currentMemoryModulesInfo.size() && count < 30;
i++, count++)
{
Process::DrawMemoryPages(i);
}
}
}ImGui::EndChild();//Get modules end

//Memory Pages
ImGui::BeginChild("Memory Pages Count", ImVec2(700, 50), 0, ImGuiWindowFlags_HorizontalScrollbar);
{
for (int i = 0; i < Process::currentMemoryModulesInfo.size() / 30; i++)
{
char buffer[12];
#pragma warning(suppress: 4996)
std::sprintf(buffer, "%d", i);
if (ImGui::Button(buffer, ImVec2(50, 30))) {
currentDrawModuleIndex = i;
}
ImGui::SameLine();
}
}ImGui::EndChild();


ImGui::EndTabItem(); //End Memory tab
}

if (ImGui::BeginTabItem("Modules Info")) {

for (int i = 0; i < Process::currentProcessModules.size(); i++)
{
Process::DrawModules(i);
}

ImGui::EndTabItem();
}

ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Find Value")) {
ImGui::InputText("Find Value", FindValue, IM_ARRAYSIZE(FindValue));

ImGui::Combo("Type", &FindValueIndex, FindValueTypes, 2);


ImGui::EndTabBar();
/*if (Process::findedCurrentProcessMemory<GetType("int")>) {

}*/



}


ImGui::EndTabItem();
}
}


ImGui::EndTabBar();
} //endTabNar
}

void startGui() {
Expand Down Expand Up @@ -172,6 +311,8 @@ void startGui() {
UI::CleanupDeviceD3D();
::DestroyWindow(hwnd);
::UnregisterClassW(wc.lpszClassName, wc.hInstance);

//Process::selectedProcess.Destroy();
}


Expand Down
Loading