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

📄 dasm.cpp

📁 十分经典的开源反编译工具
💻 CPP
📖 第 1 页 / 共 3 页
字号:
		  case VK_UP:
			 SendMessage(hwnd,WM_VSCROLL,SB_LINEUP,0L);
			 break;
		  case VK_LEFT:
			 SendMessage(hwnd,WM_HSCROLL,SB_PAGEUP,0L);
			 break;
		  case VK_RIGHT:
			 SendMessage(hwnd,WM_HSCROLL,SB_PAGEDOWN,0L);
			 break;
		  case VK_RETURN:
          if(GetKeyState(VK_SHIFT)&0x8000)
          	scheduler.addtask(user_jumptoarg2,priority_userrequest,nlptr,NULL);
          else
			 	scheduler.addtask(user_jumpto,priority_userrequest,nlptr,NULL);
			 break;
		  case VK_ESCAPE:
			 scheduler.addtask(user_jumpback,priority_userrequest,nlptr,NULL);
			 break;
		  case VK_F1:
			 DialogBox(hInst,MAKEINTRESOURCE(help_shortcuts),hwnd,(DLGPROC)helpshortcuts);
			 break;
        case VK_F3:
          searchmore();
          break;
        default:
          break;
		}
		break;
	 default:
		return DefWindowProc(hwnd,message,wParam,lParam);
  }
  return 0;
}

/************************************************************************
* changemenus                                                           *
* erm..... everytime I added a menu function I just added another line  *
* in here :)                                                            *
************************************************************************/
void changemenus(void)
{ HMENU hMenu;
  hMenu=GetMenu(mainwindow);
  EnableMenuItem(hMenu,file_open,MF_GRAYED);
  EnableMenuItem(hMenu,file_save,MF_ENABLED);
  EnableMenuItem(hMenu,save_asm,MF_ENABLED);
  EnableMenuItem(hMenu,view_segment,MF_ENABLED);
  EnableMenuItem(hMenu,view_names,MF_ENABLED);
  EnableMenuItem(hMenu,view_xrefs,MF_ENABLED);
  EnableMenuItem(hMenu,view_imports,MF_ENABLED);
  EnableMenuItem(hMenu,view_exports,MF_ENABLED);
  EnableMenuItem(hMenu,make_code,MF_ENABLED);
  EnableMenuItem(hMenu,undefine_line,MF_ENABLED);
  EnableMenuItem(hMenu,undefine_lines,MF_ENABLED);
  EnableMenuItem(hMenu,undefine_lines_long,MF_ENABLED);
  EnableMenuItem(hMenu,line_jumpto,MF_ENABLED);
  EnableMenuItem(hMenu,line_jumptoarg2,MF_ENABLED);
  EnableMenuItem(hMenu,make_dword,MF_ENABLED);
  EnableMenuItem(hMenu,make_word,MF_ENABLED);
  EnableMenuItem(hMenu,make_string,MF_ENABLED);
  EnableMenuItem(hMenu,pascal_string,MF_ENABLED);
  EnableMenuItem(hMenu,uc_string,MF_ENABLED);
  EnableMenuItem(hMenu,up_string,MF_ENABLED);
  EnableMenuItem(hMenu,dos_string,MF_ENABLED);
  EnableMenuItem(hMenu,general_string,MF_ENABLED);
  EnableMenuItem(hMenu,Name_Location,MF_ENABLED);
  EnableMenuItem(hMenu,Jump_Back,MF_ENABLED);
  EnableMenuItem(hMenu,argover_dec,MF_ENABLED);
  EnableMenuItem(hMenu,argover_hex,MF_ENABLED);
  EnableMenuItem(hMenu,argover_char,MF_ENABLED);
  EnableMenuItem(hMenu,argnegate,MF_ENABLED);
  EnableMenuItem(hMenu,offset_dseg,MF_ENABLED);
  EnableMenuItem(hMenu,main_search,MF_ENABLED);
  EnableMenuItem(hMenu,save_database,MF_ENABLED);
  EnableMenuItem(hMenu,load_database,MF_GRAYED);
  EnableMenuItem(hMenu,get_comment,MF_ENABLED);
  EnableMenuItem(hMenu,block_top,MF_ENABLED);
  EnableMenuItem(hMenu,block_bottom,MF_ENABLED);
  EnableMenuItem(hMenu,block_view,MF_ENABLED);
  EnableMenuItem(hMenu,block_saveasm,MF_ENABLED);
  EnableMenuItem(hMenu,block_savetext,MF_ENABLED);
  EnableMenuItem(hMenu,block_undefine,MF_ENABLED);
  EnableMenuItem(hMenu,float_single,MF_ENABLED);
  EnableMenuItem(hMenu,float_double,MF_ENABLED);
  EnableMenuItem(hMenu,float_longdouble,MF_ENABLED);
  EnableMenuItem(hMenu,arg_single,MF_ENABLED);
  EnableMenuItem(hMenu,search_again,MF_ENABLED);
  EnableMenuItem(hMenu,cm_decrypt,MF_ENABLED);
  EnableMenuItem(hMenu,change_oep,MF_ENABLED);
  EnableMenuItem(hMenu,jump_to,MF_ENABLED);
  EnableMenuItem(rmenu,cm_decrypt,MF_ENABLED);
  EnableMenuItem(rmenu,arg_single,MF_ENABLED);
  EnableMenuItem(rmenu,float_single,MF_ENABLED);
  EnableMenuItem(rmenu,float_double,MF_ENABLED);
  EnableMenuItem(rmenu,float_longdouble,MF_ENABLED);
  EnableMenuItem(rmenu,block_top,MF_ENABLED);
  EnableMenuItem(rmenu,block_bottom,MF_ENABLED);
  EnableMenuItem(rmenu,make_code,MF_ENABLED);
  EnableMenuItem(rmenu,get_comment,MF_ENABLED);
  EnableMenuItem(rmenu,undefine_line,MF_ENABLED);
  EnableMenuItem(rmenu,undefine_lines,MF_ENABLED);
  EnableMenuItem(rmenu,undefine_lines_long,MF_ENABLED);
  EnableMenuItem(rmenu,line_jumpto,MF_ENABLED);
  EnableMenuItem(rmenu,line_jumptoarg2,MF_ENABLED);
  EnableMenuItem(rmenu,make_dword,MF_ENABLED);
  EnableMenuItem(rmenu,make_word,MF_ENABLED);
  EnableMenuItem(rmenu,make_string,MF_ENABLED);
  EnableMenuItem(rmenu,pascal_string,MF_ENABLED);
  EnableMenuItem(rmenu,uc_string,MF_ENABLED);
  EnableMenuItem(rmenu,up_string,MF_ENABLED);
  EnableMenuItem(rmenu,dos_string,MF_ENABLED);
  EnableMenuItem(rmenu,general_string,MF_ENABLED);
  EnableMenuItem(rmenu,Name_Location,MF_ENABLED);
  EnableMenuItem(rmenu,view_xrefs,MF_ENABLED);
  EnableMenuItem(rmenu,argover_dec,MF_ENABLED);
  EnableMenuItem(rmenu,argover_hex,MF_ENABLED);
  EnableMenuItem(rmenu,argover_char,MF_ENABLED);
  EnableMenuItem(rmenu,argnegate,MF_ENABLED);
  EnableMenuItem(rmenu,offset_dseg,MF_ENABLED);
  charinputenabled=true;
}

/************************************************************************
* Thread                                                                *
* - this is the secondary thread interface. It just keeps calling the   *
*   scheduler to process any items in the queue, until such time as the *
*   main thread wants to quit.                                          *
************************************************************************/
#ifdef __BORLANDC__
#pragma warn -par
#endif
void Thread(PVOID pvoid)
{ // needs to setup initial schedule list
  // continually monitor schedule list for jobs
  do
  { if(scheduler.process())
	  if(!KillThread)
        StatusMessage("Processing Completed");
	Sleep(1);
  } while(!KillThread);
  InThread=false;
  ExitThread(0);
}
#ifdef __BORLANDC__
#pragma warn +par
#endif

/************************************************************************
* savefile_text                                                         *
* - this is the savefile as text dialog which asks the user to select   *
*   a file for the save. The filedump is then controlled by disio       *
* - this is for text or asm saves                                       *
************************************************************************/
bool savefile_text(HWND hwnd,bool printaddrs,bool block)
{ char savefname[MAX_PATH*2];
  HANDLE sbox;
  if(scheduler.sizelist())
  { MessageBox(mainwindow,"There are still items to process yet","Borg Warning",MB_OK|MB_ICONEXCLAMATION);
	 return false;
  }
  savefname[0]=0;
  getfiletosave(savefname);
  if(savefname[0])
  { sbox=CreateDialog(hInst,MAKEINTRESOURCE(save_box),mainwindow,(DLGPROC)savemessbox);
	 if(block)
      dio.dumpblocktofile(savefname,printaddrs);
    else
      dio.dumptofile(savefname,printaddrs);
	 DestroyWindow((HWND)sbox);
  }
  return 0;
}

/************************************************************************
* StatusMessage                                                         *
* - output a simple message to the status bar                           *
************************************************************************/
void StatusMessage(char *msg)
{ /*EnterCriticalSection(&cs);*/     // was causing locks (possibly)
  Status_SetText(hwndStatusBar,0,0,msg);
  /*LeaveCriticalSection(&cs);    */
}

/************************************************************************
* StatusMessageNItems                                                   *
* - shows how many items there are left to process                      *
************************************************************************/
void StatusMessageNItems(dword nolistitems)
{ static char buff[40];
  buff[39]=0; // just in case
  wsprintf(buff,"Items to Process :%lu",nolistitems);
  StatusMessage(buff);
}

/************************************************************************
* optionsinit                                                           *
* - initialises the global options struct with some default values      *
************************************************************************/
void optionsinit(void)
{ options.loaddebug=true;
  options.mode16=false;
  options.mode32=false;
  options.loaddata=true;
  options.loadresources=false;
  options.cfa=true;
  options.demangle=true;
  options.processor=PROC_PENTIUM;
  options.codedetect=CD_PUSHBP|CD_EAXFROMESP|CD_MOVEAX;
  options.bgcolor=GetSysColor(COLOR_APPWORKSPACE);
  options.highcolor=RGB(0,255,0);
  options.textcolor=0;
  options.font=ansifont;
  options.readonly=false;
  options.winmax=false;
}

/************************************************************************
* setupfont                                                             *
* - handles the setting up of a font (like selecting the object for     *
*   window painting and setting checkmarks on the menu, etc)            *
************************************************************************/
void setupfont(void)
{ HDC hdc;
  TEXTMETRIC tm;
  RECT tmp_rect;
  HMENU hMenu;
  hMenu=GetMenu(mainwindow);
  hdc=GetDC(mainwindow);
  CheckMenuItem(hMenu,font_ansi,MF_UNCHECKED);
  CheckMenuItem(hMenu,font_system,MF_UNCHECKED);
  CheckMenuItem(hMenu,font_courier,MF_UNCHECKED);
  CheckMenuItem(hMenu,font_courier10,MF_UNCHECKED);
  CheckMenuItem(hMenu,font_courier12,MF_UNCHECKED);
  switch(options.font)
  { case ansifont:
  		SelectObject(hdc,GetStockObject(ANSI_FIXED_FONT));
      CheckMenuItem(hMenu,font_ansi,MF_CHECKED);
      break;
    case systemfont:
  		SelectObject(hdc,GetStockObject(SYSTEM_FIXED_FONT));
      CheckMenuItem(hMenu,font_system,MF_CHECKED);
      break;
    case courierfont:
      if(cf!=NULL)
        DeleteObject(cf);
      cf=CreateFont(-MulDiv(8, GetDeviceCaps(hdc, LOGPIXELSY), 72),0,0,0,FW_LIGHT,0,0,0,0,0,0,0,0,"Courier New");
      if(cf==NULL)
  		  SelectObject(hdc,GetStockObject(ANSI_FIXED_FONT));
      else
        SelectObject(hdc,cf);
      CheckMenuItem(hMenu,font_courier,MF_CHECKED);
      break;
    case courierfont10:
      if(cf!=NULL)
        DeleteObject(cf);
      cf=CreateFont(-MulDiv(10, GetDeviceCaps(hdc, LOGPIXELSY), 72),0,0,0,FW_LIGHT,0,0,0,0,0,0,0,0,"Courier New");
      if(cf==NULL)
  		  SelectObject(hdc,GetStockObject(ANSI_FIXED_FONT));
      else
        SelectObject(hdc,cf);
      CheckMenuItem(hMenu,font_courier10,MF_CHECKED);
      break;
    case courierfont12:
      if(cf!=NULL)
        DeleteObject(cf);
      cf=CreateFont(-MulDiv(12, GetDeviceCaps(hdc, LOGPIXELSY), 72),0,0,0,FW_LIGHT,0,0,0,0,0,0,0,0,"Courier New");
      if(cf==NULL)
  		  SelectObject(hdc,GetStockObject(ANSI_FIXED_FONT));
      else
        SelectObject(hdc,cf);
      CheckMenuItem(hMenu,font_courier12,MF_CHECKED);
      break;
    default:
  		SelectObject(hdc,GetStockObject(ANSI_FIXED_FONT));
      CheckMenuItem(hMenu,font_ansi,MF_CHECKED);
      break;
  }
  GetTextMetrics(hdc,&tm);
  cxChar=tm.tmAveCharWidth;
  cyChar=tm.tmHeight+tm.tmExternalLeading;
  ReleaseDC(mainwindow,hdc);
  GetClientRect(mainwindow,&tmp_rect);
  InvalidateRect(mainwindow,&tmp_rect,true);
  scheduler.addtask(windowupdate,priority_window,nlptr,NULL);
}

/************************************************************************
* TestThread                                                            *
* - this is used on exit to wait for the secondary thread to finish.    *
* - I try every possible way of getting the thread to exit normally     *
*   before we eventually kill it in the mainwindow, WM_DESTROY handler  *
************************************************************************/
bool TestThread(void)
{ HWND sbox;
  bool ttest;
  sbox=CreateDialog(hInst,MAKEINTRESOURCE(Borg_Shutdown),mainwindow,(DLGPROC)shutbox);
  if(InThread)
    Sleep(1000);
  DestroyWindow(sbox);
  //EnterCriticalSection(&cs);
  ttest=InThread;
  //LeaveCriticalSection(&cs);
  return ttest;
}


⌨️ 快捷键说明

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