1
0
Fork 0

Remove redundant typedefs

This commit is contained in:
Nukem 2015-04-04 19:30:46 -04:00
parent c1115bb203
commit 0ad2701caf
11 changed files with 23 additions and 33 deletions

View File

@ -54,11 +54,17 @@ extern "C" DLL_EXPORT bool _dbg_memmap(MEMMAP* memmap)
memmap->count = pagecount;
if(!pagecount)
return true;
// Allocate memory that is already zeroed
memmap->page = (MEMPAGE*)BridgeAlloc(sizeof(MEMPAGE) * pagecount);
memset(memmap->page, 0, sizeof(MEMPAGE)*pagecount);
int j = 0;
for(MemoryMap::iterator i = memoryPages.begin(); i != memoryPages.end(); ++i, j++)
memcpy(&memmap->page[j], &i->second, sizeof(MEMPAGE));
// Copy all elements over
int i = 0;
for (auto& itr : memoryPages)
memcpy(&memmap->page[i++], &itr.second, sizeof(MEMPAGE));
// Done
return true;
}

View File

@ -4,9 +4,7 @@
#include "debugger.h"
#include "memory.h"
typedef std::unordered_map<uint, BOOKMARKSINFO> BookmarksInfo;
static BookmarksInfo bookmarks;
std::unordered_map<uint, BOOKMARKSINFO> bookmarks;
bool BookmarkSet(uint Address, bool Manual)
{

View File

@ -13,9 +13,7 @@
#include "module.h"
typedef std::pair<BP_TYPE, uint> BreakpointKey;
typedef std::map<BreakpointKey, BREAKPOINT> BreakpointsInfo;
static BreakpointsInfo breakpoints;
std::map<BreakpointKey, BREAKPOINT> breakpoints;
BREAKPOINT* BpInfoFromAddr(BP_TYPE Type, uint Address)
{

View File

@ -4,9 +4,7 @@
#include "debugger.h"
#include "memory.h"
typedef std::unordered_map<uint, COMMENTSINFO> CommentsInfo;
static CommentsInfo comments;
std::unordered_map<uint, COMMENTSINFO> comments;
bool CommentSet(uint Address, const char* Text, bool Manual)
{

View File

@ -4,9 +4,7 @@
#include "memory.h"
#include "threading.h"
typedef std::map<ModuleRange, FUNCTIONSINFO, ModuleRangeCompare> FunctionsInfo;
static FunctionsInfo functions;
std::map<ModuleRange, FUNCTIONSINFO, ModuleRangeCompare> functions;
bool FunctionAdd(uint Start, uint End, bool Manual)
{

View File

@ -4,9 +4,7 @@
#include "memory.h"
#include "debugger.h"
typedef std::unordered_map<uint, LABELSINFO> LabelsInfo;
static LabelsInfo labels;
std::unordered_map<uint, LABELSINFO> labels;
bool LabelSet(uint Address, const char* Text, bool Manual)
{

View File

@ -17,7 +17,7 @@
#define BYTES_TO_PAGES(Size) (((Size) >> PAGE_SHIFT) + (((Size) & (PAGE_SIZE - 1)) != 0))
#define ROUND_TO_PAGES(Size) (((ULONG_PTR)(Size) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
MemoryMap memoryPages;
std::map<Range, MEMPAGE, RangeCompare> memoryPages;
bool bListAllPages = false;
void MemUpdateMap(HANDLE hProcess)
@ -135,16 +135,16 @@ void MemUpdateMap(HANDLE hProcess)
}
}
uint MemFindBaseAddr(uint addr, uint* Size, bool refresh)
uint MemFindBaseAddr(uint Address, uint* Size, bool Refresh)
{
// Update the memory map if needed
if(refresh)
if(Refresh)
MemUpdateMap(fdProcessInfo->hProcess);
SHARED_ACQUIRE(LockMemoryPages);
// Search for the memory page address
auto found = memoryPages.find(std::make_pair(addr, addr));
auto found = memoryPages.find(std::make_pair(Address, Address));
if(found == memoryPages.end())
return 0;

View File

@ -3,13 +3,11 @@
#include "_global.h"
#include "addrinfo.h"
typedef std::map<Range, MEMPAGE, RangeCompare> MemoryMap;
extern MemoryMap memoryPages;
extern std::map<Range, MEMPAGE, RangeCompare> memoryPages;
extern bool bListAllPages;
void MemUpdateMap(HANDLE hProcess);
uint MemFindBaseAddr(uint addr, uint* Size, bool refresh = false);
uint MemFindBaseAddr(uint Address, uint* Size, bool Refresh = false);
bool MemRead(void* BaseAddress, void* Buffer, SIZE_T Size, SIZE_T* NumberOfBytesRead);
bool MemWrite(void* BaseAddress, void* Buffer, SIZE_T Size, SIZE_T* NumberOfBytesWritten);
bool MemPatch(void* BaseAddress, void* Buffer, SIZE_T Size, SIZE_T* NumberOfBytesWritten);

View File

@ -4,7 +4,7 @@
#include "symbolinfo.h"
#include "murmurhash.h"
static ModulesInfo modinfo;
std::map<Range, MODINFO, RangeCompare> modinfo;
bool ModLoad(uint Base, uint Size, const char* FullPath)
{

View File

@ -29,8 +29,6 @@ struct MODINFO
std::vector<MODSECTIONINFO> sections;
};
typedef std::map<Range, MODINFO, RangeCompare> ModulesInfo;
bool ModLoad(uint Base, uint Size, const char* FullPath);
bool ModUnload(uint Base);
void ModClear();

View File

@ -12,9 +12,7 @@
#include "threading.h"
#include "module.h"
typedef std::unordered_map<uint, PATCHINFO> PatchesInfo;
static PatchesInfo patches;
std::unordered_map<uint, PATCHINFO> patches;
bool PatchSet(uint Address, unsigned char OldByte, unsigned char NewByte)
{