⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 user_dlg.cpp

📁 十分经典的开源反编译工具
💻 CPP
📖 第 1 页 / 共 3 页
字号:
				SendDlgItemMessage(hdwnd,NAMES_TEXTEND,WM_SETTEXT,0,(LPARAM)(LPCTSTR)noffs);
				return true;
			 default:
				break;
		  }
		}
		break;
	 case WM_INITDIALOG:
      CenterWindow(hdwnd);
		name.resetiterator();
		for(i=0;i<name.numlistitems();i++)
		{ t=name.nextiterator();
		  SendDlgItemMessage(hdwnd,IDC_NAMESLISTBOX,LB_ADDSTRING,0,(LPARAM) (LPCTSTR)t->name);
		}
		SendDlgItemMessage(hdwnd,IDC_NAMESLISTBOX,LB_SETCURSEL,0,0);
		name.resetiterator();
		t=name.nextiterator();
		st=t->addr.segm;
		wsprintf(nseg,"0x%lx",st);
		wsprintf(noffs,"0x%lx",t->addr.offs);
		SendDlgItemMessage(hdwnd,NAMES_TEXTSTART,WM_SETTEXT,0,(LPARAM)(LPCTSTR)nseg);
		SendDlgItemMessage(hdwnd,NAMES_TEXTEND,WM_SETTEXT,0,(LPARAM)(LPCTSTR)noffs);
		SetFocus(GetDlgItem(hdwnd,IDC_OKBUTTON));
		return false;
    default:
      break;
  }
  return false;
}
#ifdef __BORLANDC__
#pragma warn +par
#endif

/************************************************************************
* getnamebox                                                            *
* - this is a small dialog for the input of name for a location. the    *
*   name is stored (pointer) in the global variable nme for the caller  *
*   to process                                                          *
************************************************************************/
#ifdef __BORLANDC__
#pragma warn -par
#endif
BOOL CALLBACK getnamebox(HWND hdwnd,UINT message,WPARAM wParam,LPARAM lParam)
{ switch(message)
  { case WM_COMMAND:
		{	switch(wParam)
		  { case IDOK:
				EndDialog(hdwnd,NULL);
				nme=new char[GNAME_MAXLEN+1];
				SendDlgItemMessage(hdwnd,IDC_NAMEEDIT,WM_GETTEXT,(WPARAM)GNAME_MAXLEN,(LPARAM)nme);
				return true;
			 case IDCANCEL:
				EndDialog(hdwnd,NULL);
				nme=NULL;
				return true;
          default:
            break;
		  }
		}
		break;
	 case WM_INITDIALOG:
      CenterWindow(hdwnd);
		SetFocus(GetDlgItem(hdwnd,IDC_NAMEEDIT));
		return false;
    default:
      break;
  }
  return false;
}
#ifdef __BORLANDC__
#pragma warn +par
#endif

/************************************************************************
* blockview                                                             *
* - this stops the secondary thread and puts up the dialog box for      *
*   viewing the extents of the block                                    *
************************************************************************/
void blockview(void)
{ scheduler.stopthread();
  DialogBox(hInst,MAKEINTRESOURCE(Block_Dialog),mainwindow,(DLGPROC)blockbox);
  scheduler.continuethread();
}

/************************************************************************
* blockbox                                                              *
* - this is the dialog which just shows the extents of the current      *
*   block                                                               *
************************************************************************/
#ifdef __BORLANDC__
#pragma warn -par
#endif
BOOL CALLBACK blockbox(HWND hdwnd,UINT message,WPARAM wParam,LPARAM lParam)
{ static char s1[30],s2[30],s3[40];
  switch(message)
  { case WM_COMMAND:
		{	switch(wParam)
		  { case IDOK:
				EndDialog(hdwnd,NULL);
				return true;
			 default:
				break;
		  }
		}
		break;
	 case WM_INITDIALOG:
      CenterWindow(hdwnd);
      wsprintf(s1,"%04x:%08lxh",blk.top.segm,blk.top.offs);
      wsprintf(s2,"%04x:%08lxh",blk.bottom.segm,blk.bottom.offs);
		SendDlgItemMessage(hdwnd,Text_Top,WM_SETTEXT,0,(LPARAM)(LPCTSTR)s1);
		SendDlgItemMessage(hdwnd,Text_Bottom,WM_SETTEXT,0,(LPARAM)(LPCTSTR)s2);
      if(blk.top==nlptr)
        strcpy(s3,"Top not set");
      else if(blk.bottom==nlptr)
        strcpy(s3,"Bottom not set");
      else if(blk.top>blk.bottom)
        strcpy(s3,"Range is empty");
      else
        strcpy(s3,"Range set");
		SendDlgItemMessage(hdwnd,Text_Status,WM_SETTEXT,0,(LPARAM)(LPCTSTR)s3);
		return false;
    default:
      break;
  }
  return false;
}
#ifdef __BORLANDC__
#pragma warn +par
#endif

/************************************************************************
* the xrefs viewer - stops the thread and continues it after            *
* displaying the dialog box                                             *
************************************************************************/
void xrefsviewer(void)
{ xrefitem *findit,xtmp;
  scheduler.stopthread();
  dio.findcurrentaddr(&xtmp.addr);
  xtmp.refby=nlptr;
  findit=xrefs.findnext(&xtmp);
  if(findit==NULL)
  { MessageBox(mainwindow,"Unable to find any xrefs for the location","Borg Message",MB_OK);
  }
  else if(findit->addr!=xtmp.addr)
  { MessageBox(mainwindow,"There are no xrefs for the current location in the list","Borg Message",MB_OK);
  }
  else
  { DialogBox((struct HINSTANCE__ *)hInst,MAKEINTRESOURCE(Xrefs_Viewer),mainwindow,(DLGPROC)xrefsbox);
  }
  scheduler.continuethread();
}

/************************************************************************
* dialog box controls and workings - most message processing is         *
* standardised across Borg (colorchanges, etc)                          *
************************************************************************/
#ifdef __BORLANDC__
#pragma warn -par
#endif
BOOL CALLBACK xrefsbox(HWND hdwnd,UINT message,WPARAM wParam,LPARAM lParam)
{ static char nseg[20],noffs[20];
  static xrefitem *currentsel,xtmp,*vt;
  static int numberofitems;
  dword st;
  dword i;
  switch(message)
  { case WM_COMMAND:
		{ switch(wParam)
		  { case IDC_OKBUTTON:
				EndDialog(hdwnd,NULL);
				return true;
			 case IDC_JUMPTOBUTTON:
				scheduler.addtask(user_jumptoaddr,priority_userrequest,currentsel->refby,NULL);
				EndDialog(hdwnd,NULL);
				return true;
			 case XREFS_DELETE:
            scheduler.addtask(user_delxref,priority_userrequest,currentsel->refby,NULL);
	         scheduler.addtask(windowupdate,priority_window,nlptr,NULL);
            if(numberofitems>1)
              scheduler.addtask(user_repeatxrefview,priority_userrequest,nlptr,NULL);
				EndDialog(hdwnd,NULL);
				return true;
			 default:
				break;
		  }
		  switch(HIWORD(wParam))
		  { case LBN_SELCHANGE:
				i=SendDlgItemMessage(hdwnd,IDC_XREFSLISTBOX,LB_GETCURSEL,0,0)+1;
				xrefs.findnext(&xtmp);
				while(i)
				{ vt=xrefs.nextiterator();
				  i--;
				}
				currentsel=vt;
				return true;
			 default:
				break;
		  }
		}
		break;
	 case WM_INITDIALOG:
      CenterWindow(hdwnd);
		dio.findcurrentaddr(&xtmp.addr);
		xtmp.refby=nlptr;
		xrefs.findnext(&xtmp);
		vt=xrefs.nextiterator();
		currentsel=vt;
      numberofitems=0;
      if(vt!=NULL)
		{ while(vt->addr==xtmp.addr)
		  { st=vt->refby.segm;
		    wsprintf(nseg,"0x%lx",st);
		    wsprintf(noffs,"0x%lx",vt->refby.offs);
		    strcat(nseg,":");
		    strcat(nseg,noffs);
          numberofitems++;
		    SendDlgItemMessage(hdwnd,IDC_XREFSLISTBOX,LB_ADDSTRING,0,(LPARAM) (LPCTSTR)nseg);
		    vt=xrefs.nextiterator();
          if(vt==NULL)
            break;
		  }
      }
		SendDlgItemMessage(hdwnd,IDC_XREFSLISTBOX,LB_SETCURSEL,0,0);
		SetFocus(GetDlgItem(hdwnd,IDC_OKBUTTON));
		return false;
    default:
      break;
  }
  return false;
}
#ifdef __BORLANDC__
#pragma warn +par
#endif

/************************************************************************
* segviewer                                                             *
* - stops the secondary thread, and calls the dialog box for viewing    *
*   the segments, then restarts the thread when the dialog box is done. *
************************************************************************/
void segviewer(void)
{ scheduler.stopthread();
  DialogBox(hInst,MAKEINTRESOURCE(Seg_Viewer),mainwindow,(DLGPROC)segbox);
  scheduler.continuethread();
}

/************************************************************************
* segbox                                                                *
* - this is the segment viewer dialog box which shows the segments, and *
*   details of them as they are clicked on. It allows jumping to the    *
*   segments as well. Background analysis is halted when calling this   *
*   particularly because iterators are used, and they there is only one *
*   iterator for the segment list                                       *
************************************************************************/
#ifdef __BORLANDC__
#pragma warn -par
#endif
BOOL CALLBACK segbox(HWND hdwnd,UINT message,WPARAM wParam,LPARAM lParam)
{ static string *segt;
  static char sstart[20],send[20],ssize[20],stype[20];
  static dsegitem *t;
  dword st;
  dword i;
  switch(message)
  { case WM_COMMAND:
		{	switch(wParam)
		  { case IDC_OKBUTTON:
				EndDialog(hdwnd,NULL);
				return true;
			 case IDC_JUMPTOBUTTON:
				scheduler.addtask(user_jumptoaddr,priority_userrequest,t->addr,NULL);
				EndDialog(hdwnd,NULL);
				return true;
			 default:
				break;
		  }
		  switch(HIWORD(wParam))
		  { case LBN_SELCHANGE:
				i=SendDlgItemMessage(hdwnd,IDC_SEGLISTBOX,LB_GETCURSEL,0,0);
				dta.resetiterator();
				t=dta.nextiterator();
				while(i)
				{ t=dta.nextiterator();
				  i--;
				}
				wsprintf(sstart,"0x%lx",t->addr.offs);
				st=t->addr.offs+t->size-1;
				wsprintf(send,"0x%lx",st);
				wsprintf(ssize,"0x%lx",t->size);
				switch(t->typ)
				{ case code16:
					 strcpy(stype,"16-bit Code");
					 break;
				  case code32:
					 strcpy(stype,"32-bit Code");
					 break;
				  case data16:
					 strcpy(stype,"16-bit Data");
					 break;
				  case data32:
					 strcpy(stype,"32-bit Data");
					 break;
				  case uninitdata:
					 strcpy(stype,"Uninit Data");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -