1
0
Fork 0

DBG: fixed various small bugs

This commit is contained in:
mr.exodia 2014-01-12 15:02:14 +01:00
parent a470348627
commit 10096c1d57
5 changed files with 15 additions and 10 deletions

View File

@ -168,7 +168,7 @@ extern "C" DLL_EXPORT bool _dbg_addrinfoget(duint addr, SEGMENTREG segment, ADDR
sprintf(temp_string, "%s:\"%s\"", instr.arg[i].mnemonic, ascii);
break;
case str_unicode:
sprintf(temp_string, "%s:L\"UNICODE\"");
sprintf(temp_string, "%s:L\"UNICODE\"", instr.arg[i].mnemonic);
break;
}
}
@ -190,7 +190,7 @@ extern "C" DLL_EXPORT bool _dbg_addrinfoget(duint addr, SEGMENTREG segment, ADDR
sprintf(temp_string, "%s:\"%s\"", instr.arg[i].mnemonic, ascii);
break;
case str_unicode:
sprintf(temp_string, "%s:L\"UNICODE\"");
sprintf(temp_string, "%s:L\"UNICODE\"", instr.arg[i].mnemonic);
break;
}
}
@ -370,15 +370,15 @@ extern "C" DLL_EXPORT bool _dbg_valtostring(const char* string, duint* value)
return valtostring(string, value, true);
}
extern "C" DLL_EXPORT int _dbg_getbplist(BPXTYPE type, BPMAP* bplist)
extern "C" DLL_EXPORT int _dbg_getbplist(BPXTYPE type, BPMAP* list)
{
if(!bplist)
if(!list)
return 0;
BREAKPOINT* list;
int bpcount=bpgetlist(&list);
if(bpcount==0)
{
bplist->count=0;
list->count=0;
return 0;
}
@ -447,10 +447,10 @@ extern "C" DLL_EXPORT int _dbg_getbplist(BPXTYPE type, BPMAP* bplist)
bridgeList.push_back(curBp);
retcount++;
}
bplist->count=retcount;
bplist->bp=(BRIDGEBP*)BridgeAlloc(sizeof(BRIDGEBP)*retcount);
list->count=retcount;
list->bp=(BRIDGEBP*)BridgeAlloc(sizeof(BRIDGEBP)*retcount);
for(int i=0; i<retcount; i++)
memcpy(&bplist->bp[i], &bridgeList.at(i), sizeof(BRIDGEBP));
memcpy(&list->bp[i], &bridgeList.at(i), sizeof(BRIDGEBP));
return retcount;
}

View File

@ -20,7 +20,7 @@ DLL_EXPORT bool _dbg_addrinfoset(duint addr, ADDRINFO* addrinfo);
DLL_EXPORT int _dbg_bpgettypeat(duint addr);
DLL_EXPORT bool _dbg_getregdump(REGDUMP* regdump);
DLL_EXPORT bool _dbg_valtostring(const char* string, duint* value);
DLL_EXPORT int _dbg_getbplist(BPXTYPE type, BPMAP* bplist);
DLL_EXPORT int _dbg_getbplist(BPXTYPE type, BPMAP* list);
DLL_EXPORT uint _dbg_getbranchdestination(uint addr);
DLL_EXPORT bool _dbg_functionoverlaps(uint start, uint end);

View File

@ -160,7 +160,8 @@ int arggetcount(const char* cmd)
if(start==len)
return arg_count;
arg_count=1;
char temp[deflen]="";
char temp_[deflen]="";
char* temp=temp_+1;
strcpy(temp, cmd);
for(int i=start; i<len; i++)
if(temp[i]=='\\' and temp[i+1]=='\\')

View File

@ -141,6 +141,7 @@ bool assemble(const char* instruction, unsigned char** outdata, int* outsize, ch
do
GetExitCodeProcess(pi.hProcess, &exitCode);
while(exitCode==STILL_ACTIVE);
CloseHandle(pi.hThread);
if(exitCode) //nasm failed
{
if(error)

View File

@ -1368,7 +1368,10 @@ CMDRESULT cbDebugFree(int argc, char* argv[])
return STATUS_ERROR;
}
else if(!lastalloc)
{
dputs("lastalloc is zero, provide a page address");
return STATUS_ERROR;
}
if(addr==lastalloc)
varset("$lastalloc", 0, true);
bool ok=VirtualFreeEx(fdProcessInfo->hProcess, (void*)addr, 0, MEM_RELEASE);