Skip to content

Commit c1dc95b

Browse files
author
dude719
committed
Added ability to input a module name in the address node. TODO: implement a module list dialog.
1 parent b008f7f commit c1dc95b

File tree

141 files changed

+51672
-35
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+51672
-35
lines changed

ReClass 2015/BeaEngine_s_stdcall.lib

525 KB
Binary file not shown.
669 KB
Binary file not shown.

ReClass 2015/BeaEngine_s_stdcalld.lib

753 KB
Binary file not shown.
852 KB
Binary file not shown.

ReClass 2015/Classes.h

+21-19
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ class CNodeBase
8484
virtual void Update(HotSpot& Spot) = 0;
8585

8686
NodeType GetType() { return nodeType; }
87+
size_t GetOffset() { return offset; }
8788

8889
NodeType nodeType;
8990

@@ -232,10 +233,11 @@ class CNodeBase
232233
{
233234
if ((y > View.client->bottom) || (y + Height < 0))
234235
return;
236+
235237
if (bSelected)
236238
View.dc->FillSolidRect(0, y, View.client->right, Height, crSelect);
237-
CRect pos;
238-
pos.SetRect(0, y, 1024, y + Height);
239+
240+
CRect pos(0, y, 1024, y + Height);
239241
AddHotSpot(View, pos, CString(), 0, HS_SELECT);
240242
}
241243

@@ -247,8 +249,7 @@ class CNodeBase
247249
DrawIconEx(View.dc->m_hDC, x, y, Icons[idx], 16, 16, 0, NULL, DI_NORMAL);
248250
if (ID != -1)
249251
{
250-
CRect pos;
251-
pos.SetRect(x, y, x + 16, y + 16);
252+
CRect pos(x, y, x + 16, y + 16);
252253
AddHotSpot(View, pos, CString(), ID, Type);
253254
}
254255
return x + 16;
@@ -284,6 +285,7 @@ class CNodeBase
284285
return;
285286
if ((y > View.client->bottom) || (y + 16 < 0))
286287
return;
288+
287289
if (bSelected)
288290
AddIcon(View, 0, y, ICON_DROPARROW, 0, HS_DROP);
289291
}
@@ -336,10 +338,10 @@ class CNodeBase
336338
return std::string(szDemangled);
337339
}
338340

339-
int ResolveRTTI(DWORD_PTR Val, int &x, ViewInfo& View, int y)
341+
int ResolveRTTI(size_t Val, int &x, ViewInfo& View, int y)
340342
{
341343
#ifdef _WIN64
342-
DWORD_PTR ModuleBase = 0x0;
344+
size_t ModuleBase = 0x0;
343345
//Find module Val is in, then get module base
344346
for (int i = 0; i < MemMapModule.size(); i++)
345347
{
@@ -351,27 +353,27 @@ class CNodeBase
351353
}
352354
}
353355

354-
DWORD_PTR pRTTIObjectLocator = Val - 8; //Val is Ptr to first VFunc, pRTTI is at -0x8
356+
size_t pRTTIObjectLocator = Val - 8; //Val is Ptr to first VFunc, pRTTI is at -0x8
355357
if (!IsValidPtr(pRTTIObjectLocator))
356358
return x;
357359

358-
DWORD_PTR RTTIObjectLocator;
360+
size_t RTTIObjectLocator;
359361
ReadMemory(pRTTIObjectLocator, &RTTIObjectLocator, sizeof(DWORD_PTR));
360362

361363
DWORD dwTypeDescriptorOffset;
362364
ReadMemory(RTTIObjectLocator + 0x0C, &dwTypeDescriptorOffset, sizeof(DWORD));
363-
DWORD_PTR TypeDescriptor = ModuleBase + dwTypeDescriptorOffset;
365+
size_t TypeDescriptor = ModuleBase + dwTypeDescriptorOffset;
364366

365367
DWORD dwObjectBaseOffset;
366368
ReadMemory(RTTIObjectLocator + 0x14, &dwObjectBaseOffset, sizeof(DWORD));
367-
DWORD_PTR ObjectBase = ModuleBase + dwObjectBaseOffset;
369+
size_t ObjectBase = ModuleBase + dwObjectBaseOffset;
368370

369371

370372
DWORD dwClassHierarchyDescriptorOffset;
371373
ReadMemory(RTTIObjectLocator + 0x10, &dwClassHierarchyDescriptorOffset, sizeof(DWORD));
372374

373375
//Offsets are from base
374-
DWORD_PTR ClassHierarchyDescriptor = ModuleBase + dwClassHierarchyDescriptorOffset;
376+
size_t ClassHierarchyDescriptor = ModuleBase + dwClassHierarchyDescriptorOffset;
375377
if (!IsValidPtr(ClassHierarchyDescriptor) || !dwClassHierarchyDescriptorOffset)
376378
return x;
377379

@@ -383,7 +385,7 @@ class CNodeBase
383385
DWORD BaseClassArrayOffset;
384386
ReadMemory(ClassHierarchyDescriptor + 0xC, &BaseClassArrayOffset, sizeof(DWORD));
385387

386-
DWORD_PTR BaseClassArray = ModuleBase + BaseClassArrayOffset;
388+
size_t BaseClassArray = ModuleBase + BaseClassArrayOffset;
387389
if (!IsValidPtr(BaseClassArray) || !BaseClassArrayOffset)
388390
return x;
389391

@@ -400,14 +402,14 @@ class CNodeBase
400402
DWORD BaseClassDescriptorOffset;
401403
ReadMemory(BaseClassArray + (0x4 * i), &BaseClassDescriptorOffset, sizeof(DWORD));
402404

403-
DWORD_PTR BaseClassDescriptor = ModuleBase + BaseClassDescriptorOffset;
405+
size_t BaseClassDescriptor = ModuleBase + BaseClassDescriptorOffset;
404406
if (!IsValidPtr(BaseClassDescriptor) || !BaseClassDescriptorOffset)
405407
continue;
406408

407409
DWORD TypeDescriptorOffset;
408410
ReadMemory(BaseClassDescriptor, &TypeDescriptorOffset, sizeof(DWORD));
409411

410-
DWORD_PTR TypeDescriptor = ModuleBase + TypeDescriptorOffset;
412+
size_t TypeDescriptor = ModuleBase + TypeDescriptorOffset;
411413
if (!IsValidPtr(TypeDescriptor) || !TypeDescriptorOffset)
412414
continue;
413415

@@ -525,8 +527,8 @@ class CNodeBase
525527

526528
int AddComment(ViewInfo& View, int x, int y)
527529
{
528-
x = AddText(View, x, y, crComment, NONE, _T("//"));
529-
x = AddText(View, x, y, crComment, HS_COMMENT, _T(" %s"), Comment);
530+
x = AddText(View, x, y, crComment, NONE, _T("// "));
531+
x = AddText(View, x, y, crComment, HS_COMMENT, _T("%s"), Comment);
530532

531533
// Added
532534
//if (GetType() == nt_int64)
@@ -601,7 +603,7 @@ class CNodeBase
601603

602604
if (bAddStr)
603605
{
604-
txt[63] = '\0';
606+
txt[64] = '\0';
605607
x = AddText(View, x, y, crChar, NONE, _T("'%hs'"), txt);
606608
}
607609
}
@@ -651,8 +653,8 @@ class CNodeBase
651653
if (gbString)
652654
{
653655
bool bAddStr = true;
654-
char txt[32];
655-
ReadMemory(Val, txt, 32); // TODO: find out why and how, and why it looks wrong
656+
char txt[64];
657+
ReadMemory(Val, txt, 64); // TODO: find out why and how, and why it looks wrong
656658

657659
for (int i = 0; i < 4; i++)
658660
{
2.56 MB
Binary file not shown.

ReClass 2015/SciLexer.lib

3.74 MB
Binary file not shown.

ReClass 2015/SciLexer_64.lib

3.84 MB
Binary file not shown.

ReClass 2015/SciLexerd.lib

4.17 MB
Binary file not shown.

ReClass 2015/SciLexerd_64.lib

4.17 MB
Binary file not shown.

ReClass 2015/stdafx.cpp

+16-16
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ CString GetAddressName(size_t Address, bool bHEX)
265265
if (Address == CustomNames[i].Address)
266266
{
267267
#ifdef _WIN64
268-
txt.Format(_T("%ls.%I64X"), CustomNames[i].Name, Address);
268+
txt.Format(_T("%s.%I64X"), CustomNames[i].Name, Address);
269269
#else
270270
txt.Format(_T("%s.%X"), CustomNames[i].Name, Address);
271271
#endif
@@ -277,7 +277,7 @@ CString GetAddressName(size_t Address, bool bHEX)
277277
if (Address == Exports[i].Address)
278278
{
279279
#ifdef _WIN64
280-
txt.Format(_T("%ls.%I64X"), Exports[i].Name, Address);
280+
txt.Format(_T("%s.%I64X"), Exports[i].Name, Address);
281281
#else
282282
txt.Format(_T("%s.%X"), Exports[i].Name, Address);
283283
#endif
@@ -313,7 +313,7 @@ CString GetAddressName(size_t Address, bool bHEX)
313313
if (Address >= MemMapModule[i].Start && Address <= MemMapModule[i].End)
314314
{
315315
#ifdef _WIN64
316-
txt.Format(_T("%ls.%I64X"), MemMapModule[i].Name, Address);
316+
txt.Format(_T("%s.%I64X"), MemMapModule[i].Name, Address);
317317
#else
318318
txt.Format(_T("%s.%X"), MemMapModule[i].Name, Address);
319319
#endif
@@ -411,7 +411,7 @@ bool UpdateMemoryMap(void)
411411
{
412412
if (VirtualQueryEx(g_hProcess, (LPCVOID)pMemory, &MemInfo, sizeof(MEMORY_BASIC_INFORMATION)) != 0)
413413
{
414-
if (MemInfo.State == MEM_COMMIT /*&& MBI.Type == MEM_PRIVATE*/)
414+
if (MemInfo.State == MEM_COMMIT /*&& MemInfo.Type == MEM_PRIVATE*/)
415415
{
416416
MemMapInfo Mem;
417417
Mem.Start = (size_t)pMemory;
@@ -427,7 +427,7 @@ bool UpdateMemoryMap(void)
427427
}
428428

429429
static HMODULE hNtDll = (HMODULE)Utils::GetLocalModuleHandle("ntdll.dll");
430-
static tNtQueryInformationProcess fnNTQIP = (tNtQueryInformationProcess)Utils::GetProcAddress(hNtDll, "NtQueryInformationProcess");
430+
static tNtQueryInformationProcess NtQueryInformationProcess = (tNtQueryInformationProcess)Utils::GetProcAddress(hNtDll, "NtQueryInformationProcess");
431431

432432
PPROCESS_BASIC_INFORMATION ProcessInfo = NULL;
433433
PEB Peb;
@@ -439,7 +439,7 @@ bool UpdateMemoryMap(void)
439439
ProcessInfo = (PPROCESS_BASIC_INFORMATION)HeapAlloc(hHeap, HEAP_ZERO_MEMORY | HEAP_GENERATE_EXCEPTIONS, dwSize);
440440

441441
ULONG dwSizeNeeded = 0;
442-
NTSTATUS status = fnNTQIP(g_hProcess, ProcessBasicInformation, ProcessInfo, dwSize, &dwSizeNeeded);
442+
NTSTATUS status = NtQueryInformationProcess(g_hProcess, ProcessBasicInformation, ProcessInfo, dwSize, &dwSizeNeeded);
443443
if (status >= 0 && dwSize < dwSizeNeeded)
444444
{
445445
if (ProcessInfo)
@@ -454,7 +454,7 @@ bool UpdateMemoryMap(void)
454454
return 0;
455455
}
456456

457-
status = fnNTQIP(g_hProcess, ProcessBasicInformation, ProcessInfo, dwSizeNeeded, &dwSizeNeeded);
457+
status = NtQueryInformationProcess(g_hProcess, ProcessBasicInformation, ProcessInfo, dwSizeNeeded, &dwSizeNeeded);
458458
}
459459

460460
// Did we successfully get basic info on process
@@ -582,7 +582,7 @@ bool UpdateMemoryMap(void)
582582
else
583583
{
584584
#ifdef _DEBUG
585-
printf("[UpdateExports]: NtQueryInformationProcess failed! Aborting UpdateExports.\n");
585+
printf("[UpdateExports]: NtQueryInformationProcess failed! Aborting...\n");
586586
#endif
587587
if (ProcessInfo)
588588
HeapFree(hHeap, 0, ProcessInfo);
@@ -608,7 +608,7 @@ bool UpdateExports()
608608
// return;
609609

610610
static HMODULE hNtDll = (HMODULE)Utils::GetLocalModuleHandle("ntdll.dll");
611-
static tNtQueryInformationProcess fnNTQIP = (tNtQueryInformationProcess)Utils::GetProcAddress(hNtDll, "NtQueryInformationProcess");
611+
static tNtQueryInformationProcess NtQueryInformationProcess = (tNtQueryInformationProcess)Utils::GetProcAddress(hNtDll, "NtQueryInformationProcess");
612612

613613
PPROCESS_BASIC_INFORMATION ProcessInfo = NULL;
614614
PEB Peb;
@@ -620,7 +620,7 @@ bool UpdateExports()
620620
ProcessInfo = (PPROCESS_BASIC_INFORMATION)HeapAlloc(hHeap, HEAP_ZERO_MEMORY | HEAP_GENERATE_EXCEPTIONS, dwSize);
621621

622622
ULONG dwSizeNeeded = 0;
623-
NTSTATUS status = fnNTQIP(g_hProcess, ProcessBasicInformation, ProcessInfo, dwSize, &dwSizeNeeded);
623+
NTSTATUS status = NtQueryInformationProcess(g_hProcess, ProcessBasicInformation, ProcessInfo, dwSize, &dwSizeNeeded);
624624
if (status >= 0 && dwSize < dwSizeNeeded)
625625
{
626626
if (ProcessInfo)
@@ -635,7 +635,7 @@ bool UpdateExports()
635635
return 0;
636636
}
637637

638-
status = fnNTQIP(g_hProcess, ProcessBasicInformation, ProcessInfo, dwSizeNeeded, &dwSizeNeeded);
638+
status = NtQueryInformationProcess(g_hProcess, ProcessBasicInformation, ProcessInfo, dwSizeNeeded, &dwSizeNeeded);
639639
}
640640

641641
// Did we successfully get basic info on process
@@ -717,9 +717,9 @@ bool UpdateExports()
717717
{
718718
IMAGE_EXPORT_DIRECTORY ExpDir;
719719
ReadProcessMemory(g_hProcess, (LPCVOID)(ModuleHandle + NtHdr.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress), &ExpDir, sizeof(ExpDir), NULL);
720-
PVOID pName = (void*)(ModuleHandle + ExpDir.AddressOfNames);
721-
PVOID pOrd = (void*)(ModuleHandle + ExpDir.AddressOfNameOrdinals);
722-
PVOID pAddress = (void*)(ModuleHandle + ExpDir.AddressOfFunctions);
720+
PVOID pName = (PVOID)(ModuleHandle + ExpDir.AddressOfNames);
721+
PVOID pOrd = (PVOID)(ModuleHandle + ExpDir.AddressOfNameOrdinals);
722+
PVOID pAddress = (PVOID)(ModuleHandle + ExpDir.AddressOfFunctions);
723723

724724
ULONG aNames[MAX_EXPORTS];
725725
WORD aOrds[MAX_EXPORTS];
@@ -915,7 +915,7 @@ size_t ConvertStrToAddress(CString Address)
915915
}
916916
else
917917
{
918-
curadd = (__int64)StrToNum(a.GetBuffer(), a.GetLength(), 16);
918+
curadd = (size_t)_tcstoui64(a.GetBuffer(), NULL, 16);//StrToNum(a.GetBuffer(), a.GetLength(), 16);
919919
//printf( "Final [%p] %d\n", curadd, a.GetLength( ) );
920920
}
921921

@@ -926,7 +926,7 @@ size_t ConvertStrToAddress(CString Address)
926926
//printf( "here2\n" );
927927
if (ReadProcessMemory(g_hProcess, (PVOID)Final, &Final, sizeof(Final), NULL) == 0)
928928
{
929-
wprintf(L"[ConvertStrToAddress]: Failed to read memory (stdafx.cpp) GetLastError() = %d\n", GetLastError());
929+
_tprintf(_T("[ConvertStrToAddress]: Failed to read memory (stdafx.cpp) GetLastError() = %d\n"), GetLastError());
930930
}
931931
}
932932
}

0 commit comments

Comments
 (0)