int wndprog_get_text(char *s, char *mask, int *select, t_sortheader *ph, int column) //獲取文本
{
unsigned int ret; //返回
t_wndprog_data *pline = (t_wndprog_data *)ph; //pline行
t_wndprog_data *plineBf = (t_wndprog_data *) Getsortedbyselection(&(ollylang->wndProg.data),pline->line-1); //獲取分類節
t_wndprog_data *plineAf = (t_wndprog_data *) Getsortedbyselection(&(ollylang->wndProg.data),pline->line+1); //獲取分類節
t_dump *cpuasm; //轉儲結構
int p;
cpuasm = (t_dump*) Plugingetvalue(VAL_CPUDASM); //插件值
ret = sprintf(s,""); //打印
switch (column) //colum不為0
{
case 0:
if (pline->line>0) //pline行大於0
ret = sprintf(s, "%d", pline->line); //打印行
else if (pline->line==-1) //如果pline行為-1
ret = sprintf(s, "LOAD"); //打印加載
if (pline->type & PROG_TYPE_COMMENT) //如果類型為註釋comment
{
*select=DRAW_MASK; //重畫標籤
memset(mask,DRAW_GRAY,ret); //內存設置
}
if (pline->pause) //如果為暫停
{
//Hilite Breakpoint
*select=DRAW_MASK; //重畫標籤
memset(mask,DRAW_BREAK,ret); //設置mask為DRAW_BREAK
}
else if (pline->line == ollylang->pgr_scriptpos) //如果行為pgr腳本指針
{
//Hilite Current Line
*select=DRAW_MASK;
memset(mask,DRAW_EIP,ret); //DRAW_EIP
}
else if (pline->type & PROG_TYPE_LABEL) //類型為PROG_TYPE_LABEL
{
*select=DRAW_MASK;
memset(mask,DRAW_GRAY,ret);
}
break;
case 1: //為1的時候
if (pline->type & PROG_TYPE_COMMENT) //註釋comment
{
ret = sprintf(s, "%s", &pline->command); //打印行命令
*select=DRAW_MASK;
memset(mask,DRAW_GRAY,ret);
}
else if ((pline->type & PROG_TYPE_LABEL) || pline->line == 0) //如果類型為標籤,行為0
{
ret = sprintf(s, "%s", &pline->command[1]); //打印命令1
memset(&s[ret],'_',PROG_CMD_LEN-ret); //
ret=PROG_CMD_LEN;
*select=DRAW_MASK;
memset(mask,DRAW_GRAY,ret);
}
else if (pline->type & PROG_TYPE_ASM) { //類型為彙編
ret = sprintf(s, " %s", pline->command); //打印命令
*select=DRAW_MASK;
memset(mask,DRAW_GRAY,ret);
}
else
{
ret = sprintf(s, "%s", pline->command); //其他打印命令
memset(mask,DRAW_NORMAL,ret);
}
if (pline->line == ollylang->pgr_scriptpos && ret>0) //
{
//Hilite Current Line
*select=DRAW_MASK;
memset(mask,DRAW_EIP,ret);
}
else if ((pline->type & PROG_ATTR_EXECUTED) && !(pline->type & PROG_TYPE_COMMENT) && ret>0)
{
//Hilite executed lines
*select=DRAW_MASK;
memset(mask,DRAW_HILITE,ret);
}
//Error warning
if (pline->type & PROG_ATTR_ERROR) //error
{
*s='!';
*select=DRAW_MASK;
*mask=DRAW_BREAK;
}
//DRAW JUMP ARROWS
if (pline->jumpto > 0) //如果跳轉到大於0
{
if (pline->jumpto < pline->line) //如果跳轉到小於行
{
*s='U';
}
else
{
*s='D';
}
*select=DRAW_MASK;
*mask=DRAW_GRAPH;
}
break;
case 2:
if (pline->type & PROG_TYPE_LABEL) //標籤
{
ret=PROG_RES_LEN;
memset(s,'_',ret);
*select=DRAW_MASK;
memset(mask,DRAW_GRAY,ret);
//ret=30;strcpy(s,"N .BIJKESTU<Duvdeijrsfgahztbcl");
//ret=30;strcpy(s,"Duvdeijrsfgahztbcl");
//memset(mask,DRAW_GRAPH,ret);
}
else if (*pline->result != NULL)
{
if (plineBf)
{
if (strcmp(plineBf->result,pline->result)==0)
{
//Same result as previous line
*select=DRAW_MASK;
*s=' '; s[1]=D_GRAYPATH;
ret=2;
memset(mask,DRAW_GRAPH,ret);
break;
}
}
ret = sprintf(s, "%s", pline->result);
}
break;
case 3:
if (pline->type & PROG_TYPE_LABEL)
{
memset(s,'_',9);
ret=9;
*select=DRAW_MASK;
memset(mask,DRAW_GRAY,ret);
}
else if (pline->eip>0)
{
if (plineBf)
{
if (plineBf->eip == pline->eip)
{
if (plineAf)
if (plineAf->eip != pline->eip) goto draw_normal_eip;
*select=DRAW_MASK;
*s=' ';
if (cpuasm->sel0 == pline->eip)
s[1]=D_PATH;
else
s[1]=D_GRAYPATH;
ret=2;
memset(mask,DRAW_GRAPH,ret);
break;
}
}
draw_normal_eip:
ret = sprintf(s, "%08X", pline->eip);
if (cpuasm->sel0 == pline->eip)
{
//Hilite current eip
*select=DRAW_MASK;
memset(mask,DRAW_HILITE,ret);
}
}
break;
case 4:
if (pline->type & PROG_TYPE_LABEL)
{
memset(s,'_',PROG_VAL_LEN);
ret=PROG_VAL_LEN;
*select=DRAW_MASK;
memset(mask,DRAW_GRAY,ret);
}
else if (*pline->values != NULL)
{
if (pline->values[0] != ',')
ret = sprintf(s, "%s", pline->values);
else
{
ret = sprintf(s, "%s", &pline->values[1]);
p = strchr(&pline->values[1],',')-pline->values;
if (p>0)
{
*select=DRAW_MASK;
memset(mask,DRAW_NORMAL,ret);
memset(mask,DRAW_HILITE,p-1);
}
}
}
break;
}
if (!ret) ret=strlen(s);
return ret;
}
没有评论:
发表评论