Ejemplo n.º 1
0
bool CCmdLog::create()
{
	if (m_Table.hw != nullptr) return true;
	if ( Createtablewindow(
		&m_Table, 0, m_Table.bar.nbar, NULL, TEXT("ICO_L"), LOGNAME
	) == nullptr ) {
		Addtolist(		// .................
			reinterpret_cast<ulong>(GetRetAddr()), DRAW_HILITE, 
			text("Fail to create logger window .")
		);	return false;
	} else return true;
}
Ejemplo n.º 2
0
// Menu processing function
static int menu_handler(t_table *pt,wchar_t *name,ulong index,int mode) {
	if (mode==MENU_VERIFY)
		return MENU_NORMAL;                
	else if (mode==MENU_EXECUTE) 
	{
		if (handletable.hw==NULL)
			Createtablewindow(&handletable,0,handletable.bar.nbar,NULL,NULL,PLUGIN_NAME);
		else
			Activatetablewindow(&handletable);
		if(get_debugged_pid())
			payload();
		return MENU_REDRAW;
	}
	return MENU_ABSENT;
}
Ejemplo n.º 3
0
bool CCmdLog::Create()
{
	::wcscpy_s(m_Table.name, SHORTNAME, LOGNAME);	// name .
	m_Table.mode = TABLE_SAVEALL|TABLE_USERDEF|TABLE_RIGHTSEL;
	m_Table.subtype			= 0;	// not figure out yet ..
	m_Table.bottomspace		= m_Table.minwidth = 0;
	m_Table.tabfunc			= CCmdLog::TableProc;
	m_Table.drawfunc			= CCmdLog::DrawProc;
	//m_Table.updatefunc		= CCmdLog::UpdateProc;
	//m_Table.tableselfunc		= CCmdLog::TabSelProc;
	m_Table.menu				= m_pMenu + 0;
	m_Table.custommode		= 0;
	m_Table.customdata		= this;
	// Now, initialize the t_bar ..
	m_Table.bar.nbar			= 5;
	m_Table.bar.visible		= 1;
	m_Table.bar.name[0]		= TEXT("No");
	m_Table.bar.expl[0]		= TEXT("The logging item");
	m_Table.bar.mode[0]		= BAR_SORT;
	m_Table.bar.defdx[0]		= 5 * 1;
	m_Table.bar.name[1]		= TEXT("Time");
	m_Table.bar.expl[1]		= TEXT("The logging time");
	m_Table.bar.mode[1]		= BAR_SORT;
	m_Table.bar.defdx[1]		= 5 * 3;
	m_Table.bar.name[2]		= TEXT("Type");
	m_Table.bar.expl[2]		= TEXT("The logging type");
	m_Table.bar.mode[2]		= BAR_SORT;
	m_Table.bar.defdx[2]		= 5 * 2;
	m_Table.bar.name[3]		= TEXT("Code");
	m_Table.bar.expl[3]		= TEXT("The replied error code");
	m_Table.bar.mode[3]		= BAR_SORT;
	m_Table.bar.defdx[3]		= 5 * 1;
	m_Table.bar.name[4]		= TEXT("Echo");
	m_Table.bar.expl[4]		= TEXT("The replied message");
	m_Table.bar.mode[4]		= BAR_BUTTON;
	m_Table.bar.defdx[4]		= 5 * 50;

	if ( Createtablewindow(
		&m_Table, 0, m_Table.bar.nbar, NULL, TEXT("ICO_L"), LOGNAME
	) == nullptr ) {
		Addtolist(		// .................
			reinterpret_cast<ulong>(GetRetAddr()), DRAW_HILITE, 
			text("Fail to create logger window .")
		);	return false;
	} else return true;
}
Ejemplo n.º 4
0
static int MCompareTrace(t_table *pt,wchar_t *name,ulong index,int mode) {
  wchar_t buffer[100];
  uchar * codeline;
  ulong codelinesize;

  if (mode==MENU_VERIFY)
    return MENU_NORMAL;                // Always available
  else if (mode==MENU_EXECUTE) {
    ulong i,j,length, declength;
    uchar cmd[MAXCMDSIZE],*decode;
	t_disasm da;
    t_reg *reg;
	void * result;
	t_memory *pmem;
    t_hitlist hitlistitem;
    Deletesorteddatarange(&(hitlisttable.sorted),0,0xFFFFFFFF);
	for ( i=0; i<memory.sorted.n; i++) {
      pmem=(t_memory *)Getsortedbyindex(&memory.sorted,i);    // Get next memory block.
	  if ((pmem->type & MEM_GAP)!=0)
        continue;                        // Unallocated memory
      // Check whether it contains executable code.
      if ((pmem->type & (MEM_CODE|MEM_SFX))==0)
        continue;                        // Not a code   	  
	  // iterate through code
      for ( j=pmem->base; j<=pmem->base +pmem->size; j++) {
	    codeline = Finddecode(j,&codelinesize);
		if (codeline)
			if (((*codeline)&DEC_TRACED)==DEC_TRACED){
				result = Findsorteddata(&baselist,j,0);
				//Addtolist(result,DRAW_NORMAL,L"sorted");
				if(!result){
                  length=Readmemory(cmd,j,MAXCMDSIZE,MM_SILENT|MM_PARTIAL);
                  if (length==0) Addtolist(j,DRAW_NORMAL,L"Readmemory returned zero!");
                  decode=Finddecode(j,&declength);
                  if (decode!=NULL && declength<length) 
                     decode=NULL;
                  length=Disasm(cmd,length,j,decode,&da,DA_TEXT|DA_OPCOMM|DA_MEMORY,NULL,NULL);
                  if (length==0) Addtolist(j,DRAW_NORMAL,L"Disasm returned zero!");
                  StrcopyW(hitlistitem.decodedinstruction,TEXTLEN,da.result);
			      hitlistitem.index=j;
                  hitlistitem.size=1;
                  hitlistitem.type=0;
                  Addsorteddata(&(hitlisttable.sorted),&hitlistitem);
				}
			}
		}
	  }
	if (hitlisttable.hw==NULL){
      // Create table window. Third parameter (ncolumn) is the number of
      // visible columns in the newly created window (ignored if appearance is
      // restored from the initialization file). If it's lower than the total
      // number of columns, remaining columns are initially invisible. Fourth
      // parameter is the name of icon - as OllyDbg resource.
      Createtablewindow(&hitlisttable,0,hitlisttable.bar.nbar,NULL, L"ICO_PLUGIN",PLUGINNAME);
	}
    else
      Activatetablewindow(&hitlisttable);
	return MENU_REDRAW;
	}
  return MENU_ABSENT;
};