int main(int argc,char** argv) { int old_apage; int old_vpage; int new_apage; int new_vpage; struct videoconfig vc; int ret; if(argc==1) { cputs("用法:\n\tcread 文件名\n"); return 0; } // set_video_mode(&vc); // ROWS=_setvideomoderows(_TEXTC80,_MAXTEXTROWS); _getvideoconfig(&vc); ROWS = vc.numtextrows; COLS = vc.numtextcols; old_apage = _getactivepage(); old_vpage = _getvisualpage(); if(vc.numvideopages>1) { if(old_apage >=1) { new_apage = 0; } else { new_apage = 1; } } else { new_apage = old_apage; } if(old_apage != new_apage) { _setvisualpage(new_apage); _setactivepage(new_apage); _clearscreen(_GCLEARSCREEN); } print_videoconfig(&vc); OUT_PRINTF_BEGIN "old_visualpage=%d\nold_active_page=%d\n", old_vpage, old_apage OUT_PRINTF_END new_vpage = _getvisualpage(); new_apage = _getactivepage(); OUT_PRINTF_BEGIN "new_visualpage=%d\nnew_active_page=%d\n", new_vpage, new_apage OUT_PRINTF_END ret = process(argc,argv); _setactivepage(old_apage); _setvisualpage(old_vpage); // _setvideomode( _DEFAULTMODE ); return ret; }
char showprogresswin() { char str[256]; char *szMethod[] = {"overwrite with 00","overwrite with FF", "random data","NSA method", "Old NSA method","DoD STD method", "NATO method","Gutmann method"}; _setvisualpage(PAGE_PROGRESS); _setactivepage(PAGE_PROGRESS); drawbox(1, 1, g_SysInfo.nmaxrows, g_SysInfo.nmaxcols); _settextposition(7, 4); sprintf(str,"Delete Method : %s",szMethod[g_nMethod]); _outtext(str); _settextposition(7, 6+strlen(str)); if (g_bBeepOff) sprintf(str,"Beep Status : Off"); else sprintf(str,"Beep Status : On"); _outtext(str); drawbox(11, 4, 13, g_SysInfo.nmaxcols - 3); _settextposition(12,6 ); charstostr(str,PROGRESS_CHAR,g_SysInfo.nmaxcols - 10); _outtext(str); if(deletecontent()) { _clearscreen(_GCLEARSCREEN); return 's'; } else { _clearscreen(_GCLEARSCREEN); return 'e'; } }
char showmethodwin() { int i,nWidth; int nmethod; int nselect = 0; char ch; char Method[40]; char *str[] = {"( ) [B]eep Off","[O]k","[C]ancel"}; static point ptmethodok,ptmethodcancel,ptmethodbeep; char *szMethod[] = {"Overwrite with 00","Overwrite with FF", "Overwrite with random data","NSA method", "Old NSA method","DoD STD method", "NATO method","Gutmann method"}; _setvisualpage(PAGE_METHOD); _setactivepage(PAGE_METHOD); nmethod = g_nMethod; drawbox(1, 1, g_SysInfo.nmaxrows, g_SysInfo.nmaxcols); _settextposition(3, 4); _outtext("Please select the method :"); g_pMethodSelWin = new cwindow(PAGE_METHOD, 5, 4, 15, 40); for(i=0;i<8;i++) { sprintf(Method,"( ) %s",szMethod[i]); g_pMethodSelWin->additemNotSort(Method,i); } ptmethodcancel.row = 23; nWidth = strlen(str[2]); ptmethodcancel.col = g_SysInfo.nmaxcols - 2 - nWidth; _settextposition(ptmethodcancel.row, ptmethodcancel.col); _outtext(str[2]); drawbox(ptmethodcancel.row - 1, ptmethodcancel.col - 1, ptmethodcancel.row + 1, ptmethodcancel.col + nWidth); nWidth = strlen(str[1]); ptmethodok.row = ptmethodcancel.row; ptmethodok.col = ptmethodcancel.col - 2 -nWidth; _settextposition(ptmethodok.row, ptmethodok.col); _outtext(str[1]); drawbox(ptmethodok.row - 1, ptmethodok.col - 1, ptmethodok.row + 1, ptmethodok.col + nWidth); ptmethodbeep.row = 18; ptmethodbeep.col = 6; _settextposition(ptmethodbeep.row, ptmethodbeep.col); if (g_bBeepOff) str[0][1] = '*'; else str[0][1] = ' '; _outtext(str[0]); SetSelMethod(nmethod); winproc(g_pMethodSelWin, WM_ACTIVE); while(1) { ch = _getch(); switch(ch) { case 'b': case 'B': nselect = 1; // winproc(g_pMethodSelWin, WM_INACTIVE); selectstr(str[0], ptmethodbeep.row, ptmethodbeep.col, SELCOLOR); break; case 'o': case 'O': g_nMethod = nmethod; _clearscreen(_GCLEARSCREEN); delete g_pMethodSelWin; return 'o'; case 'c': case 'C': case ESC : _clearscreen(_GCLEARSCREEN); delete g_pMethodSelWin; return 'c'; case SPACE : switch (nselect) { case 0: if(nmethod != g_pMethodSelWin->m_pitemactive->btItem) { nmethod = g_pMethodSelWin->m_pitemactive->btItem; } g_pMethodSelWin->emptyitem(); g_pMethodSelWin->emptyscreen(); for(i=0;i<8;i++) { sprintf(Method,"( ) %s",szMethod[i]); g_pMethodSelWin->additemNotSort(Method,i); } SetSelMethod(nmethod); break; case 1: g_bBeepOff = !g_bBeepOff; if (g_bBeepOff) str[0][1] = '*'; else str[0][1] = ' '; _settextposition(ptmethodbeep.row, ptmethodbeep.col); _outtext(str[0]); selectstr(str[0], ptmethodbeep.row, ptmethodbeep.col, SELCOLOR); break; case 2: g_nMethod = nmethod; _clearscreen(_GCLEARSCREEN); delete g_pMethodSelWin; return 'o'; case 3: _clearscreen(_GCLEARSCREEN); delete g_pMethodSelWin; return 'c'; } break; case 0: switch(ch = _getch()) { case SHIFT_TAB: switch(nselect) { case 0: nselect = 3; winproc(g_pMethodSelWin, WM_INACTIVE); selectstr(str[2], ptmethodcancel.row, ptmethodcancel.col, SELCOLOR); break; case 1: nselect = 0; winproc(g_pMethodSelWin, WM_ACTIVE); selectstr(str[0], ptmethodbeep.row, ptmethodbeep.col, TEXTCOLOR); break; case 2: nselect = 1; selectstr(str[0], ptmethodbeep.row, ptmethodbeep.col, SELCOLOR); selectstr(str[1], ptmethodok.row, ptmethodok.col, TEXTCOLOR); break; case 3: nselect = 2; selectstr(str[1], ptmethodok.row, ptmethodok.col, SELCOLOR); selectstr(str[2], ptmethodcancel.row, ptmethodcancel.col, TEXTCOLOR); break; } break; case PAGEDOWN: case PAGEUP: case CTRL_END: case CTRL_HOME: case UP: case DOWN: winproc(g_pMethodSelWin, WM_KEY, ch); break; } break; case TAB: switch(nselect) { case 0: nselect = 1; winproc(g_pMethodSelWin, WM_INACTIVE); selectstr(str[0], ptmethodbeep.row, ptmethodbeep.col, SELCOLOR); break; case 1: nselect = 2; selectstr(str[0], ptmethodbeep.row, ptmethodbeep.col, TEXTCOLOR); selectstr(str[1], ptmethodok.row, ptmethodok.col, SELCOLOR); break; case 2: nselect = 3; selectstr(str[2], ptmethodcancel.row, ptmethodcancel.col, SELCOLOR); selectstr(str[1], ptmethodok.row, ptmethodok.col, TEXTCOLOR); break; case 3: nselect = 0; winproc(g_pMethodSelWin, WM_ACTIVE); selectstr(str[2], ptmethodcancel.row, ptmethodcancel.col, TEXTCOLOR); break; } break; case CR: switch(nselect) { case 2: g_nMethod = nmethod; _clearscreen(_GCLEARSCREEN); delete g_pMethodSelWin; return 'o'; case 3: _clearscreen(_GCLEARSCREEN); delete g_pMethodSelWin; return 'c'; } } } }
char showdelparwin() { int nWidth; int i; char ch; char szResult = 'c'; char szdrv[40],szStrCheck[65]; char *str[] = {"[V]iew Partition","Delete [M]ethod" ,"[D]elete ","[C]ancel"}; static point ptvpar, ptoption,ptdelpardel,ptdelparcancel; _itemnode *pitemHD; char *szMethod[] = {"00 overwrite","FF overwrite", "random data","NSA method", "Old NSA method","DoD STD method", "NATO method","Gutmann method"}; _setvisualpage(PAGE_DELPAR); _setactivepage(PAGE_DELPAR); ptvpar.row = 23; ptvpar.col = 5; drawbox(1, 1, g_SysInfo.nmaxrows, g_SysInfo.nmaxcols); _settextposition(2, 4); _outtext("Select the partition to be deleted"); _settextposition(4, 5); _outtext("PhysicalDisk: Drive Type Size(MB) Active Pri/Log"); _settextposition(12, 4); // 2004.08.03 huapage modify begin // _outtext("Selected partition"); _outtext("Partition information:"); // 2004.08.03 huapage modify end //Add&Init Disk select window g_pDelParDiskWin = new cwindow(PAGE_DELPAR, 5, 4, 11, 20); for(i = 0; i < g_nDiskNum; i++) // no A: B: { sprintf(szdrv, DRIVEFORMAT, i + 1); g_pDelParDiskWin->additemNotSort(szdrv,i); } g_pDelParDiskWin->enabledscroll(); if(!g_delparinfo.nseldisk) g_delparinfo.nseldisk = g_pDelParDiskWin->m_pitemactive->btItem+DISKBASE; SetDelParDiskSel(g_delparinfo.nseldisk-DISKBASE); //Add&Init Partition select window g_pDelParPartWin = new cwindow(PAGE_DELPAR, 5, 22, 11, 78); writedriveletter(g_pDelParDiskWin, g_pDelParPartWin); //Add show selected partition information window g_pDelParSelWin = new cwindow(PAGE_DELPAR, 13, 4, 18, 78); //show delete method sprintf(szdrv,"Delete partition with %s",szMethod[g_nMethod]); _settextposition(19, 4); _outtext(szdrv); // Add function box nWidth = strlen(str[0]); _settextposition(ptvpar.row, ptvpar.col); _outtext(str[0]); drawbox(ptvpar.row - 1, ptvpar.col - 1, ptvpar.row + 1, ptvpar.col + nWidth); ptoption.row = ptvpar.row; ptoption.col = ptvpar.col + nWidth + 2; nWidth = strlen(str[1]); _settextposition(ptoption.row, ptoption.col); _outtext(str[1]); drawbox(ptoption.row - 1, ptoption.col - 1, ptoption.row + 1, ptoption.col + nWidth); nWidth = strlen(str[3]); ptdelparcancel.row = ptvpar.row; ptdelparcancel.col = g_SysInfo.nmaxcols - 2 - nWidth; _settextposition(ptdelparcancel.row, ptdelparcancel.col); _outtext(str[3]); drawbox(ptdelparcancel.row - 1, ptdelparcancel.col - 1, ptdelparcancel.row + 1, ptdelparcancel.col + nWidth); nWidth = strlen(str[2]); ptdelpardel.row = ptdelparcancel.row; ptdelpardel.col = ptdelparcancel.col - 2 -nWidth; _settextposition(ptdelpardel.row, ptdelpardel.col); _outtext(str[2]); drawbox(ptdelpardel.row - 1, ptdelpardel.col - 1, ptdelpardel.row + 1, ptdelpardel.col + nWidth); SetDelParSelDisk(); showtarparinfo(); winproc(g_pDelParPartWin, WM_INACTIVE); switch(g_delparinfo.nselect) { case 0: winproc(g_pDelParDiskWin, WM_ACTIVE); break; case 1: winproc(g_pDelParPartWin, WM_ACTIVE); break; case 2: selectstr(str[0], ptvpar.row, ptvpar.col, SELCOLOR); break; case 3: selectstr(str[1], ptoption.row, ptoption.col, SELCOLOR); break; case 4: selectstr(str[2], ptdelpardel.row, ptdelpardel.col, SELCOLOR); break; case 5: selectstr(str[3], ptdelparcancel.row, ptdelparcancel.col, SELCOLOR); break; } while(1) { ch = _getch(); switch(ch) { case 'm': case 'M': _clearscreen(_GCLEARSCREEN); DeleteDelParWin(); return 'm'; case 'v': case 'V': // if(g_delparinfo.nselpar == -1) if( SEL_PAR_INIT_VALUE == g_delparinfo.nselpar ) { ErrorMessageBox(NO_SELPAR); break; } _clearscreen(_GCLEARSCREEN); DeleteDelParWin(); return 'v'; case 'd': case 'D': // 2004.08.03 huapage modify begin // if(g_delparinfo.nselpar == -1) if( SEL_PAR_INIT_VALUE == g_delparinfo.nselpar) // 2004.08.03 huapage modify end { ErrorMessageBox(NO_SELPAR); break; } _clearscreen(_GCLEARSCREEN); DeleteDelParWin(); return 'd'; case 'C': case 'c': case ESC : _clearscreen(_GCLEARSCREEN); DeleteDelParWin(); return 'c'; case SPACE : if( 1 == g_delparinfo.nselect) // if the tab stop is in the proper window { pitemHD = g_pDelParPartWin->m_pitemhead; while(pitemHD!=NULL) { if(pitemHD->szitemtext[SELPOINT] == SELFLAG)//no selected { pitemHD->szitemtext[SELPOINT] = ' '; } pitemHD = pitemHD->pnext; } i=1; while(i<6) { g_pDelParPartWin->gettext(szStrCheck,i); szStrCheck[0]=0x20; if(szStrCheck[2]=='X') { writestr(PAGE_DELPAR, 5 + i, 23 + SELPOINT, " "); } i++; } if( g_delparinfo.nselpar != ( g_pDelParPartWin->m_pitemactive->btItem -1) ) { g_pDelParPartWin->m_pitemactive->szitemtext[SELPOINT] = SELFLAG; writestr(PAGE_DELPAR, 5 + g_pDelParPartWin->m_nactiverow, 23 + SELPOINT, SELFLAG_STRING); // 2004.08.02 huapage added begin // now we add select all, so nselpar should minus one g_delparinfo.nselpar = g_pDelParPartWin->m_pitemactive->btItem - 1; // 2004.08.02 huapage added end } else //already selected { // 2004.08.03 huapage comment begin // g_delparinfo.nselpar =-1; // 2004.08.03 huapage comment end g_delparinfo.nselpar = SEL_PAR_INIT_VALUE; } showtarparinfo(); } else { // do nothing if the focus is not // in the proper window and // user press space } break; case 0: switch(ch = _getch()) { case SHIFT_TAB: switch(g_delparinfo.nselect) { case 0: g_delparinfo.nselect = 5; selectstr(str[3], ptdelparcancel.row, ptdelparcancel.col, SELCOLOR); winproc(g_pDelParDiskWin, WM_INACTIVE); break; case 1: g_delparinfo.nselect = 0; winproc(g_pDelParDiskWin, WM_ACTIVE); winproc(g_pDelParPartWin, WM_INACTIVE); break; case 2: g_delparinfo.nselect = 1; selectstr(str[0], ptvpar.row, ptvpar.col, TEXTCOLOR); winproc(g_pDelParPartWin, WM_ACTIVE); //showtarparinfo(); break; case 3: g_delparinfo.nselect = 2; selectstr(str[0], ptvpar.row, ptvpar.col, SELCOLOR); selectstr(str[1], ptoption.row, ptoption.col, TEXTCOLOR); break; case 4: g_delparinfo.nselect = 3; selectstr(str[1], ptoption.row, ptoption.col, SELCOLOR); selectstr(str[2], ptdelpardel.row, ptdelpardel.col, TEXTCOLOR); break; case 5: g_delparinfo.nselect = 4; selectstr(str[2], ptdelpardel.row, ptdelpardel.col, SELCOLOR); selectstr(str[3], ptdelparcancel.row, ptdelparcancel.col, TEXTCOLOR); break; } break; case PAGEDOWN: case PAGEUP: case CTRL_END: case CTRL_HOME: case UP: case DOWN: if(g_delparinfo.nselect == 0) { g_pDelParDiskWin->m_pitemactive->szitemtext[1] = ' '; writestr(PAGE_DELPAR, 5+g_pDelParDiskWin->m_nactiverow , 6, " "); winproc(g_pDelParDiskWin, WM_KEY, ch); g_pDelParDiskWin->m_pitemactive->szitemtext[1] = '*'; writestr(PAGE_DELPAR, 5+g_pDelParDiskWin->m_nactiverow , 6, "*"); g_delparinfo.nseldisk = g_pDelParDiskWin->m_pitemactive->btItem+DISKBASE; writedriveletter(g_pDelParDiskWin, g_pDelParPartWin); // 2004.08.03 huapage modify begin // g_delparinfo.nselpar = -1; g_delparinfo.nselpar = SEL_PAR_INIT_VALUE; // 2004.08.03 huapage modify end showtarparinfo(); } if(g_delparinfo.nselect == 1) { winproc(g_pDelParPartWin, WM_KEY, ch); //showtarparinfo(); } break; } break; case TAB: switch(g_delparinfo.nselect) { case 0: g_delparinfo.nselect = 1; winproc(g_pDelParDiskWin, WM_INACTIVE); winproc(g_pDelParPartWin, WM_ACTIVE); //showtarparinfo(); break; case 1: g_delparinfo.nselect = 2; selectstr(str[0], ptvpar.row, ptvpar.col, SELCOLOR); winproc(g_pDelParPartWin, WM_INACTIVE); break; case 2: g_delparinfo.nselect = 3; selectstr(str[0], ptvpar.row, ptvpar.col, TEXTCOLOR); selectstr(str[1], ptoption.row, ptoption.col, SELCOLOR); break; case 3: g_delparinfo.nselect = 4; selectstr(str[1], ptoption.row, ptoption.col, TEXTCOLOR); selectstr(str[2], ptdelpardel.row, ptdelpardel.col, SELCOLOR); break; case 4: g_delparinfo.nselect = 5; selectstr(str[2], ptdelpardel.row, ptdelpardel.col, TEXTCOLOR); selectstr(str[3], ptdelparcancel.row, ptdelparcancel.col, SELCOLOR); break; case 5: g_delparinfo.nselect = 0; selectstr(str[3], ptdelparcancel.row, ptdelparcancel.col, TEXTCOLOR); winproc(g_pDelParDiskWin, WM_ACTIVE); break; } break; case CR: switch(g_delparinfo.nselect) { case 2: // if(g_delparinfo.nselpar == -1) if(SEL_PAR_INIT_VALUE == g_delparinfo.nselpar) { ErrorMessageBox(NO_SELPAR); break; } _clearscreen(_GCLEARSCREEN); DeleteDelParWin(); return 'v'; case 3: _clearscreen(_GCLEARSCREEN); DeleteDelParWin(); return 'm'; case 4: // 2004.08.03 huapage modify begin // if(g_delparinfo.nselpar == -1) if(SEL_PAR_INIT_VALUE == g_delparinfo.nselpar) // 2004.08.03 huapage modify end { ErrorMessageBox(NO_SELPAR); break; } _clearscreen(_GCLEARSCREEN); DeleteDelParWin(); return 'd'; case 5: _clearscreen(_GCLEARSCREEN); DeleteDelParWin(); return 'c'; } default:break; } } }
char showdiskviewwin() { int i; int nWidth,nErr; char szdrv[40]; char ch; char *str[] = {"[S]elect sector"}; static point ptselsec; BIOS_DRIVE_PARAM DriveParam; _setvisualpage(PAGE_DISKVIEW); _setactivepage(PAGE_DISKVIEW); ptselsec.row = 5; ptselsec.col = 64; drawbox(1, 1, g_SysInfo.nmaxrows, g_SysInfo.nmaxcols); _settextposition(2, 4); _outtext("Sector information of hard disk"); //Create and init disk selecter window. g_pDiskViewDiskWin = new cwindow(PAGE_DISKVIEW, 3, 4, 7, 35); //for(i = 0; i < g_nDiskNum; i++) for(i = 0; i < g_nDiskNum; i++) { GetDriveParam(i+DISKBASE,&DriveParam); sprintf(szdrv, DISKFORMAT, i + 1,DriveParam.dwSectorL/2048); g_pDiskViewDiskWin->additemNotSort(szdrv,i); } g_pDiskViewDiskWin->enabledscroll(); if(!g_diskviewinfo.nSelDisk) g_diskviewinfo.nSelDisk = g_pDiskViewDiskWin->m_pitemactive->btItem+DISKBASE; GetDriveParam(g_diskviewinfo.nSelDisk,&DriveParam); SetDiskSelecter(g_diskviewinfo.nSelDisk-DISKBASE); if(g_diskviewinfo.dwMinSec == g_diskviewinfo.dwMaxSec) { g_diskviewinfo.dwMinSec = 0; g_diskviewinfo.dwMaxSec = DriveParam.dwSectorL-1; } //Show selected disk number. _settextposition(2, 36); sprintf(szdrv,DISKVIEWDISKINFO,g_diskviewinfo.nSelDisk-DISKBASE +1, g_diskviewinfo.dwMinSec,g_diskviewinfo.dwMaxSec); _outtext(szdrv); //Create and init show selected sector detail window. g_pDiskViewInfoWin = new cwindow(PAGE_DISKVIEW,9,2,23,79); ShowSectorInfo(g_pDiskViewInfoWin,g_diskviewinfo.dwSelSec,g_diskviewinfo.nSelDisk,&DriveParam,&nErr); g_pDiskViewInfoWin->enabledscroll(); if(g_diskviewinfo.nselect == 2) winproc(g_pDiskViewInfoWin, WM_ACTIVE); //Init and Show absolute sector _settextposition(8,4); _outtext("Physical Sector: Absolute Sector "); _settextposition(8,37); sprintf(szdrv,ABSLUTESECTOR,g_diskviewinfo.dwSelSec); _outtext(szdrv); //Add function box nWidth = strlen(str[0]); _settextposition(ptselsec.row, ptselsec.col); _outtext(str[0]); drawbox(ptselsec.row - 1, ptselsec.col - 1, ptselsec.row + 1, ptselsec.col + nWidth); _settextposition(24, 45); _outtext("PageUp/PageDown:Prev/Next sector"); showchs(&DriveParam); //Set active item switch(g_diskviewinfo.nselect) { case 0: winproc(g_pDiskViewDiskWin, WM_ACTIVE); break; case 1: if(g_diskviewinfo.nselect == 1) selectstr(str[0], ptselsec.row, ptselsec.col, SELCOLOR); winproc(g_pDiskViewDiskWin, WM_INACTIVE); break; case 2: winproc(g_pDiskViewInfoWin, WM_ACTIVE); winproc(g_pDiskViewDiskWin, WM_INACTIVE); break; } while(1) { ch = _getch(); switch(ch) { case 's': case 'S': _clearscreen(_GCLEARSCREEN); DeleteDiskViewWin(); return 's'; case 'C': case 'c': case ESC : _clearscreen(_GCLEARSCREEN); DeleteDiskViewWin(); memset(&g_diskviewinfo,0,sizeof(_diskviewinfo)); return 'c'; case CR: if(g_diskviewinfo.nselect == 1) { _clearscreen(_GCLEARSCREEN); DeleteDiskViewWin(); return 's'; } break; case TAB: switch(g_diskviewinfo.nselect) { case 0: g_diskviewinfo.nselect = 1; selectstr(str[0], ptselsec.row, ptselsec.col, SELCOLOR); winproc(g_pDiskViewDiskWin, WM_INACTIVE); break; case 1: g_diskviewinfo.nselect = 2; selectstr(str[0], ptselsec.row, ptselsec.col, TEXTCOLOR); winproc(g_pDiskViewInfoWin, WM_ACTIVE); break; case 2: g_diskviewinfo.nselect = 0; winproc(g_pDiskViewDiskWin, WM_ACTIVE); winproc(g_pDiskViewInfoWin, WM_INACTIVE); break; } break; case 0: switch(ch = _getch()) { case SHIFT_TAB: switch(g_diskviewinfo.nselect) { case 0: g_diskviewinfo.nselect = 2; winproc(g_pDiskViewDiskWin, WM_INACTIVE); winproc(g_pDiskViewInfoWin, WM_ACTIVE); break; case 1: g_diskviewinfo.nselect = 0; selectstr(str[0], ptselsec.row, ptselsec.col, TEXTCOLOR); winproc(g_pDiskViewDiskWin, WM_ACTIVE); break; case 2: g_diskviewinfo.nselect = 1; selectstr(str[0], ptselsec.row, ptselsec.col, SELCOLOR); winproc(g_pDiskViewInfoWin, WM_INACTIVE); break; } break; case PAGEDOWN: if(g_diskviewinfo.dwSelSec != g_diskviewinfo.dwMaxSec) { g_diskviewinfo.dwSelSec ++; _settextposition(8,37); _outtext(NULLSTRING); _settextposition(8,37); sprintf(szdrv,ABSLUTESECTOR,g_diskviewinfo.dwSelSec); _outtext(szdrv); ShowSectorInfo(g_pDiskViewInfoWin,g_diskviewinfo.dwSelSec, g_diskviewinfo.nSelDisk,&DriveParam,&nErr); g_pDiskViewInfoWin->enabledscroll(); if(g_diskviewinfo.nselect == 2) { winproc(g_pDiskViewInfoWin, WM_ACTIVE); } showchs(&DriveParam); } break; case PAGEUP: if(g_diskviewinfo.dwSelSec != g_diskviewinfo.dwMinSec) { g_diskviewinfo.dwSelSec --; _settextposition(8,37); _outtext(NULLSTRING); _settextposition(8,37); sprintf(szdrv,ABSLUTESECTOR,g_diskviewinfo.dwSelSec); _outtext(szdrv); ShowSectorInfo(g_pDiskViewInfoWin,g_diskviewinfo.dwSelSec, g_diskviewinfo.nSelDisk,&DriveParam,&nErr); g_pDiskViewInfoWin->enabledscroll(); if(g_diskviewinfo.nselect == 2) { winproc(g_pDiskViewInfoWin, WM_ACTIVE); } showchs(&DriveParam); } break; case CTRL_END: case CTRL_HOME: case UP: case DOWN: if(g_diskviewinfo.nselect == 0 && !g_diskviewinfo.bDisableSwitchDisk) { g_pDiskViewDiskWin->m_pitemactive->szitemtext[1] = ' '; writestr(PAGE_DISKVIEW, 3+g_pDiskViewDiskWin->m_nactiverow , 6, " "); winproc(g_pDiskViewDiskWin, WM_KEY, ch); g_pDiskViewDiskWin->m_pitemactive->szitemtext[1] = '*'; writestr(PAGE_DISKVIEW, 3+g_pDiskViewDiskWin->m_nactiverow , 6, "*"); g_diskviewinfo.nSelDisk = g_pDiskViewDiskWin->m_pitemactive->btItem+DISKBASE; GetDriveParam(g_diskviewinfo.nSelDisk,&DriveParam); g_diskviewinfo.dwSelSec = 0; g_diskviewinfo.dwMinSec = 0; g_diskviewinfo.dwMaxSec = DriveParam.dwSectorL-1; _settextposition(2,36); _outtext(NULLSTRING); _settextposition(2, 36); sprintf(szdrv,DISKVIEWDISKINFO,g_diskviewinfo.nSelDisk-DISKBASE +1, g_diskviewinfo.dwMinSec,g_diskviewinfo.dwMaxSec); _outtext(szdrv); _settextposition(8,37); _outtext(NULLSTRING); _settextposition(8,37); sprintf(szdrv,ABSLUTESECTOR,g_diskviewinfo.dwSelSec); _outtext(szdrv); ShowSectorInfo(g_pDiskViewInfoWin,g_diskviewinfo.dwSelSec, g_diskviewinfo.nSelDisk,&DriveParam,&nErr); g_pDiskViewInfoWin->enabledscroll(); showchs(&DriveParam); } if(g_diskviewinfo.nselect == 2) { winproc(g_pDiskViewInfoWin, WM_KEY, ch); } break; } break; } } }
char showfinishwin() { char ch; int nWidth,nselect; char *str[] = {"Change [L]og Drive","[S]ave report","[F]inish"}; static point ptlogdrive,ptsave,ptfinish; label_start_show: _setvisualpage(PAGE_FINISH); _setactivepage(PAGE_FINISH); drawbox(1, 1, g_SysInfo.nmaxrows, g_SysInfo.nmaxcols); _settextposition(3, (g_SysInfo.nmaxcols-20)/2); _outtext("Delete Successfuly"); drawbox(2, (g_SysInfo.nmaxcols-20)/2-3, 4, (g_SysInfo.nmaxcols-20)/2+20); _settextposition(7, 4); _outtext("is deleted completely by the NSA method."); nWidth = strlen(str[2]); ptfinish.row = 23; ptfinish.col = g_SysInfo.nmaxcols - 2 - nWidth; _settextposition(ptfinish.row, ptfinish.col); _outtext(str[2]); drawbox(ptfinish.row - 1, ptfinish.col - 1, ptfinish.row + 1, ptfinish.col + nWidth); nWidth = strlen(str[1]); ptsave.row = 23; ptsave.col = ptfinish.col - 2 - nWidth; _settextposition(ptsave.row, ptsave.col); _outtext(str[1]); drawbox(ptsave.row - 1, ptsave.col - 1, ptsave.row + 1, ptsave.col + nWidth); nWidth = strlen(str[0]); ptlogdrive.row = 23; ptlogdrive.col = ptsave.col - 2 - nWidth; _settextposition(ptlogdrive.row, ptlogdrive.col); _outtext(str[0]); drawbox(ptlogdrive.row - 1, ptlogdrive.col - 1, ptlogdrive.row + 1, ptlogdrive.col + nWidth); finishshowtarget(); selectstr(str[1], ptsave.row, ptsave.col, SELCOLOR); nselect = 1; while(1) { ch = _getch(); switch(ch) { case 's': case 'S': if (!SaveReportEx(g_chLogDrive)) { ErrorMessageBox("Fail to save report!"); break; } _clearscreen(_GCLEARSCREEN); return 's'; case 'F': case 'f': case ESC : _clearscreen(_GCLEARSCREEN); return 'f'; case 'l': case 'L': showsellogdrivewin(); goto label_start_show; break; case TAB: switch(nselect) { case 1: nselect = 2; selectstr(str[1], ptsave.row, ptsave.col, TEXTCOLOR); selectstr(str[2], ptfinish.row,ptfinish.col, SELCOLOR); break; case 2: nselect = 0; selectstr(str[2], ptfinish.row, ptfinish.col, TEXTCOLOR); selectstr(str[0], ptlogdrive.row, ptlogdrive.col, SELCOLOR); break; case 0: nselect = 1; selectstr(str[0], ptlogdrive.row, ptlogdrive.col, TEXTCOLOR); selectstr(str[1], ptsave.row, ptsave.col, SELCOLOR); break; } break; case CR: switch (nselect) { case 0: showsellogdrivewin(); goto label_start_show; break; case 1: if (!SaveReportEx(g_chLogDrive)) { ErrorMessageBox("Fail to save report!"); break; } _clearscreen(_GCLEARSCREEN); return 's'; case 2: _clearscreen(_GCLEARSCREEN); return 'f'; } case 0: switch(ch = _getch()) { case SHIFT_TAB: switch(nselect) { case 1: nselect = 2; selectstr(str[1], ptsave.row, ptsave.col, TEXTCOLOR); selectstr(str[2], ptfinish.row,ptfinish.col, SELCOLOR); break; case 2: nselect = 0; selectstr(str[2], ptfinish.row, ptfinish.col, TEXTCOLOR); selectstr(str[0], ptlogdrive.row, ptlogdrive.col, SELCOLOR); break; case 0: nselect = 1; selectstr(str[0], ptlogdrive.row, ptlogdrive.col, TEXTCOLOR); selectstr(str[1], ptsave.row, ptsave.col, SELCOLOR); break; } } break; } } }