Beispiel #1
0
void BeyeContext::show_usage() const {
    beye_priv& priv = static_cast<beye_priv&>(opaque);
    unsigned evt,i,nln,h,y;
    TWindow *win;
    nln = sizeof(beyeArg)/sizeof(struct tagbeyeArg);
    h = nln+4;
    y = priv._tconsole->vio_height()/2-h/2;
    win = new(zeromem) TWindow(2,y,priv._tconsole->vio_width()-2,h+2,TWindow::Flag_None | TWindow::Flag_NLS);

    win->set_title(BEYE_VER_MSG,TWindow::TMode_Center,error_cset.border);
    win->into_center();
    win->set_color(error_cset.main);
    win->set_frame(TWindow::DOUBLE_FRAME,error_cset.border);
    win->set_footer(" Press [ ESC ] to quit ",TWindow::TMode_Right,error_cset.border);
    win->clear();
    win->goto_xy(1,1);
    win->puts(" Usage: beye [OPTIONS] file...");
    for(i = 0;i < nln;i++)
    {
	win->goto_xy(1,4+i);
	win->printf("  %s     %s\n",beyeArg[i].key,beyeArg[i].prompt);
    }
    win->show();
    do {
	evt = GetEvent(NULL,NULL,priv.ErrorWnd);
    }while(!(evt == KE_ESCAPE || evt == KE_F(10) || evt == KE_ENTER));
    delete win;
}
Beispiel #2
0
TWindow *__FASTCALL__ PleaseWaitWnd()
{
   TWindow *w;
   w = CrtDlgWndnls(SYSTEM_BUSY,14,1);
   w->goto_xy(1,1); w->puts(PLEASE_WAIT);
   return w;
}
Beispiel #3
0
void BeyeContext::init_tconsole( unsigned long vio_flg,unsigned long twin_flg )
{
    beye_priv& priv = static_cast<beye_priv&>(opaque);
    priv._tconsole=twInit(system(),codepage,vio_flg,twin_flg);
    if(priv._tconsole->vio_width() < 80 || priv._tconsole->vio_height() < 3) {
	if(priv._tconsole->vio_width()>16 && priv._tconsole->vio_height()>2) {
	    unsigned evt,x,y;
	    TWindow *win;
	    x = (priv._tconsole->vio_width()-17)/2;
	    y = (priv._tconsole->vio_height()-3)/2;
	    win = new(zeromem) TWindow(x,y,x+16,y+2,TWindow::Flag_None | TWindow::Flag_NLS);
	    if(!win) goto done;
	    win->set_title(" Error ",TWindow::TMode_Center,error_cset.border);
	    win->into_center();
	    win->set_color(error_cset.main);
	    win->set_frame(TWindow::DOUBLE_FRAME,error_cset.border);
	    win->goto_xy(1,1);
	    win->puts("Screensize<80x3");
	    win->show();
	    do {
		evt = GetEvent(NULL,NULL,win);
	    }while(!(evt == KE_ESCAPE || evt == KE_F(10) || evt == KE_ENTER));
	    delete win;
	}
done:
	twDestroy();
	std::cerr<<"Current size of video buffer is: w="<<priv._tconsole->vio_width()<<" h="<<priv._tconsole->vio_height()<<std::endl;
	throw std::runtime_error("Size of video buffer must be larger than 79x2");
    }
}
Beispiel #4
0
void PharLap_Parser::PLSegPaint(TWindow& win,const std::vector<PLSegInfo>& names,unsigned start) const
{
    const PLSegInfo& nam = names[start];
    win.freeze();
    win.clear();
    std::ostringstream oss;
    oss<<" Segment Table [ "<<(start + 1)<<" / "<<names.size()<<" ] ";
    win.set_title(oss.str(),TWindow::TMode_Center,dialog_cset.title);
    win.set_footer(PAGEBOX_SUB,TWindow::TMode_Right,dialog_cset.selfooter);
    win.goto_xy(1,1);
    win.printf(
	  "Selector number            = %04hXH\n"
	  "Flags                      = %04hXH\n"
	  "Base offset of selector    = %08lXH\n"
	  "Min extra memory alloc     = %08lXH"
	  ,nam.siSelector
	  ,nam.siFlags
	  ,nam.siBaseOff
	  ,nam.siMinAlloc);
    win.refresh_full();
}
Beispiel #5
0
void PharLap_Parser::PLRunTimePaint(TWindow& win,const std::vector<PLRunTimeParms>& names,unsigned start) const
{
    std::ostringstream oss;
    char sign[3];
    const PLRunTimeParms& nam = names[start];
    win.freeze();
    win.clear();
    oss<<" Run-time Parameters Table [ "<<(start + 1)<<" / "<<names.size()<<" ] ";
    win.set_title(oss.str(),TWindow::TMode_Center,dialog_cset.title);
    win.set_footer(PAGEBOX_SUB,TWindow::TMode_Right,dialog_cset.selfooter);
    strncpy(sign,(const char *)nam.rtSignature,2);
    sign[2] = 0;
    win.goto_xy(1,1);
    win.printf(
	  "Signature                      = %s\n"
	  "Min. number of real-mode parms = %04hXH\n"
	  "Max. number of real-mode parms = %04hXH\n"
	  "Min. interrupt buffer size     = %04hXH\n"
	  "Max. interrupt buffer size     = %04hXH\n"
	  "Number of interrupt stacks     = %04hXH\n"
	  "Size of each interrupt stack   = %04hXH\n"
	  "Offset of end of real-mode data= %08lXH\n"
	  "Call buffer size               = %04hXH\n"
	  "Flags                          = %04hXH\n"
	  "Unpriviledge flags             = %04hXH"
	  ,sign
	  ,nam.rtMinRModeParms
	  ,nam.rtMaxRModeParms
	  ,nam.rtMinIBuffSize
	  ,nam.rtMaxIBuffSize
	  ,nam.rtNIStacks
	  ,nam.rtIStackSize
	  ,nam.rtEndRModeOffset
	  ,nam.rtCallBuffSize
	  ,nam.rtFlags
	  ,nam.rtUnprivFlags);
    win.refresh_full();
}
Beispiel #6
0
__filesize_t BMP_Parser::show_header() const
{
    unsigned keycode;
    TWindow * hwnd;
    BITMAPINFOHEADER bmph;
    __filesize_t fpos,fpos2;
    fpos = bctx.tell();
    main_handle.seek(2,binary_stream::Seek_Set);
    /*filesize = */main_handle.read(type_dword);
    main_handle.seek(4,binary_stream::Seek_Cur);
    fpos2=main_handle.read(type_word); /* data offset */
    main_handle.seek(2,binary_stream::Seek_Cur);
    binary_packet bp=main_handle.read(sizeof(BITMAPINFOHEADER)); memcpy(&bmph,bp.data(),bp.size());
    hwnd = CrtDlgWndnls(" BMP File Header ",43,6);
    hwnd->goto_xy(1,1);
    hwnd->printf(
	  "WxH                  = %lux%lu\n"
	  "PlanesxBitCount      = %ux%u\n"
	  "Compression          = %c%c%c%c\n"
	  "ImageSize            = %lu\n"
	  "XxYPelsPerMeter      = %lux%lu\n"
	  "ColorUsedxImportant  = %lux%lu\n"
	  ,bmph.biWidth,bmph.biHeight
	  ,bmph.biPlanes,bmph.biBitCount
	  INT_2_CHAR_ARG(bmph.biCompression)
	  ,bmph.biSizeImage
	  ,bmph.biXPelsPerMeter,bmph.biYPelsPerMeter
	  ,bmph.biClrUsed,bmph.biClrImportant);
    while(1) {
	keycode = GetEvent(drawEmptyPrompt,NULL,hwnd);
	if(keycode == KE_F(5) || keycode == KE_ENTER) { fpos = fpos2; break; }
	else if(keycode == KE_ESCAPE || keycode == KE_F(10)) break;
    }
    delete hwnd;
    return fpos;
}
Beispiel #7
0
__filesize_t SisX_Parser::show_header() const
{
    unsigned keycode;
    TWindow* hwnd;
    const char *cpuname,*exetype;
    struct E32ImageHeader img;
    __filesize_t fpos,fpos2;
    fpos2=fpos = bctx.tell();
    main_handle.seek(0,binary_stream::Seek_Set);
    binary_packet bp=main_handle.read(sizeof(img)); memcpy(&img,bp.data(),bp.size());
    switch(img.iUid1) {
	case 0x10000079: exetype="DLL"; break;
	case 0x1000007A: exetype="EXE"; break;
	default: exetype="UNK"; break;
    }
    switch(img.iCpuIdentifier) {
	case 0x1000: cpuname="x86"; break;
	case 0x2000: cpuname="ARMv4"; break;
	case 0x2001: cpuname="ARMv5"; break;
	case 0x2002: cpuname="ARMv6"; break;
	case 0x2003: cpuname="ARMv7"; break;
	case 0x2004: cpuname="ARMv8"; break;
	case 0x2005: cpuname="ARMv9"; break;
	case 0x4000: cpuname="MCore"; break;
	default:     cpuname="unknown"; break;
    }
    std::ostringstream oss;
    oss<<" E32Image Header ("<<exetype<<")";
    hwnd = CrtDlgWndnls(oss.str(),68,15);
    hwnd->goto_xy(1,1);
    hwnd->printf(
	  "Module/Tool Version  = 0x%08X/0x%08X\n"
	  "Compression Type     = 0x%08X\n"
	  "Flags                = 0x%08X (%s %s %s %s %s)\n"
	  "Code/Data size       = 0x%08X/0x%08X\n"
	  "Min/Max heap size    = 0x%08X/0x%08X\n"
	  "Stack/BSS size       = 0x%08X/0x%08X\n"
	  "Entry point          = 0x%08X\n"
	  "Code/Data base       = 0x%08X/0x%08X\n"
	  "Code/Data offset     = 0x%08X/0x%08X\n"
	  "DLL ref offset/count = 0x%08X/%u\n"
	  "ExportDir offset/cnt = 0x%08X/%u\n"
	  "Text size            = %u\n"
	  "Code/Data Reloc off  = 0x%08X/0x%08X\n"
	  "Process priority     = 0x%04X\n"
	  "CPU identifier       = 0x%04X(%s)\n"
	  ,img.iModuleVersion,img.iToolsVersion
	  ,img.iCompressionType
	  ,img.iFlags
	  ,img.iFlags&0x10000000?"PE_Fmt":""
	  ,img.iFlags&0x02000000?"Fmt_Ver":""
	  ,img.iFlags&0x00000020?"EKA2":""
	  ,img.iFlags&0x00000008?"EABI":""
	  ,img.iFlags&0x10000002?"No_call":""
	  ,img.iCodeSize,img.iDataSize
	  ,img.iHeapSizeMin,img.iHeapSizeMax
	  ,img.iStackSize,img.iBssSize
	  ,img.iEntryPoint
	  ,img.iCodeBase,img.iDataBase
	  ,img.iCodeOffset,img.iDataOffset
	  ,img.iImportOffset,img.iDllRefTableCount
	  ,img.iExportDirOffset,img.iExportDirCount
	  ,img.iTextSize
	  ,img.iCodeRelocOffset,img.iDataRelocOffset
	  ,img.iProcessPriority
	  ,img.iCpuIdentifier,cpuname
	  );
    while(1) {
	keycode = GetEvent(drawEmptyPrompt,NULL,hwnd);
	if(keycode == KE_F(5) || keycode == KE_ENTER) { fpos = fpos2; break; }
	else if(keycode == KE_ESCAPE || keycode == KE_F(10)) break;
    }
    delete hwnd;
    return fpos;
}
Beispiel #8
0
__filesize_t PharLap_Parser::show_header() const
{
  __filesize_t fpos;
  TWindow *w;
  unsigned keycode;
  char sign[3];
  fpos = bctx.tell();
  strncpy(sign,(char *)nph.plSignature,2);
  sign[2] = 0;
  w = CrtDlgWndnls(" New PharLap executable ",59,23);
  w->goto_xy(1,1);
  w->printf(
	   "Signature                        = %s\n"
	   "Level                            = %s\n"
	   "Header size                      = %04XH\n"
	   "File size                        = %08lXH\n"
	   "Check sum (32-bit checksum)      = %04XH (%08lXH)\n"
	   "Run-time parameters (offset/size)= %08lXH/%08lXH\n"
	   "Relocations (offset/size)        = %08lXH/%08lXH\n"
	   "Segment info table (offset/size) = %08lXH/%08lXH\n"
	   "Image (offset/size)              = %08lXH/%08lXH\n"
	   "Symbol table (offset/size)       = %08lXH/%08lXH\n"
	   "GDT (offset/size)                = %08lXH/%08lXH\n"
	   "LDT (offset/size)                = %08lXH/%08lXH\n"
	   "IDT (offset/size)                = %08lXH/%08lXH\n"
	   "TSS (offset/size)                = %08lXH/%08lXH\n"
	   "Min. number of extra 4K pages    = %08lXH\n"
	   "Max. number of extra 4K pages    = %08lXH\n"
	   "Image base (flat level only)     = %08lXH\n"
	   "Initial stack (SS:ESP)           = %04XH:%08lXH\n"
	   "Initail code  (CS:EIP)           = %04XH:%08lXH\n"
	   "Initial LDT/TSS                  = %04XH/%04XH\n"
	   "Flags                            = %04XH\n"
	   "Memory requirement for image     = %08lXH\n"
	   "Stack size                       = %08lXH"
	   ,sign
	   ,nph.plLevel == 0x01 ? "Flat" : nph.plLevel == 0x02 ? "Multisegmented" : "Unknown"
	   ,nph.plHeaderSize
	   ,nph.plFileSize
	   ,nph.plCheckSum,nph.plChecksum32
	   ,nph.plRunTimeParms,nph.plRunTimeSize
	   ,nph.plRelocOffset,nph.plRelocSize
	   ,nph.plSegInfoOffset,nph.plSegInfoSize
	   ,nph.plImageOffset,nph.plImageSize
	   ,nph.plSymTabOffset,nph.plSymTabSize
	   ,nph.plGDTOffset,nph.plGDTSize
	   ,nph.plLDTOffset,nph.plLDTSize
	   ,nph.plIDTOffset,nph.plIDTSize
	   ,nph.plTSSOffset,nph.plTSSSize
	   ,nph.plMinExtraPages
	   ,nph.plMaxExtraPages
	   ,nph.plBase
	   ,nph.plSS,nph.plESP
	   ,nph.plCS,nph.plEIP
	   ,nph.plLDT,nph.plTSS
	   ,nph.plFlags
	   ,nph.plMemReq
	   ,nph.plStackSize);
  while(1)
  {
    keycode = GetEvent(drawEmptyPrompt,NULL,w);
    if(keycode == KE_ENTER) { /* fpos = entrypoint*/; break; }
    else
      if(keycode == KE_ESCAPE || keycode == KE_F(10)) break;
  }
  delete w;
  return fpos;
}