| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 5174 人关注过本帖
标题:念初中时编的dos 6.22启动盘源代码,现在好像不用了,把原码贴出来,高手见 ...
只看楼主 加入收藏
yuki
Rank: 2
等 级:新手上路
威 望:5
帖 子:508
专家分:0
注 册:2005-2-4
收藏
 问题点数:0 回复次数:35 
念初中时编的dos 6.22启动盘源代码,现在好像不用了,把原码贴出来,高手见笑了。。

/* App.H */ #include <stdio.h> #include <stdlib.h> #include <graphics.h> #include <conio.h> #include <string.h> #include <dos.h> #include <dir.h> #include <bios.h>

#define UPKEY 0x4800 #define DOWNKEY 0x5000 #define ESC 0x011b #define ENTER 0x1c0d #define F1 0x3b00

void initDrv(void){ int gdriver = DETECT, gmode, errorcode; initgraph(&gdriver, &gmode, ""); errorcode = graphresult(); if (errorcode != grOk) { printf("Graphics error: %s\n", grapherrormsg(errorcode)); printf("Press any key to halt:"); getch(); exit(1); } } void closeDrv(void){ closegraph(); } int ctextx(int x1,int x2,char * str){ int x; x = ((x1 + x2) - strlen(str) * 8)/2; return x; } int ctexty(int y1,int y2){ int y; y = (y1 + y2 - 6) /2; return y; } void fillbox_3D(int x1,int y1,int x2,int y2){ setcolor(15); line(x1,y1,x2,y1); line(x1,y1+1,x2,y1+1); line(x1,y1,x1,y2); line(x1+1,y1,x1+1,y2); setcolor(8); line(x2,y1,x2,y2); line(x2-1,y1,x2-1,y2); line(x1,y2,x2,y2); line(x1,y2-1,x2,y2-1); setfillstyle(1,7); bar(x1+2,y1+2,x2-2,y2-2); } void fillbox_3D_Down(int x1,int y1,int x2,int y2,int c){ setcolor(8); line(x1,y1,x2,y1); line(x1,y1+1,x2,y1+1); line(x1,y1,x1,y2); line(x1+1,y1,x1+1,y2); setcolor(15); line(x2,y1,x2,y2); line(x2-1,y1,x2-1,y2); line(x1,y2,x2,y2); line(x1,y2-1,x2,y2-1); setfillstyle(1,c); bar(x1+2,y1+2,x2-2,y2-2); }

void fillbox_2D(int x1,int y1,int x2,int y2,int fallpat,int fallc,int lc){ setcolor(lc); line(x1,y1,x2,y1); line(x1,y1,x1,y2); line(x2,y1,x2,y2); line(x1,y2,x2,y2); setfillstyle(fallpat,fallc); bar(x1+1,y1+1,x2-1,y2-1); } void draw_win_3D(int x1,int y1,int x2,int y2,int tc,char * title,int wc){ fillbox_3D(x1,y1,x2,y2); setcolor(8); line(x1+3,y1+3,x2-3,y1+3); line(x1+3,y1+3,x1+3,y1+22); setcolor(15); line(x1+3,y1+22,x2-3,y1+22); line(x2-3,y1+3,x2-3,y1+22); setfillstyle(1,tc); bar(x1+4,y1+4,x2-4,y1+21); int x = ctextx(x1+3,x2-3,title); int y = ctexty(y1+3,y1+22); setcolor(wc); outtextxy(x,y,title); } void auto_line(int x1,int y1,int x2,int y2){ setcolor(8); line(x1,y1,x2,y2); setcolor(15); line(x1,y1+1,x2,y2+1); } void buttonUp(int x1,int y1,int x2,int y2,char * Caption){ setcolor(15); line(x1,y1,x2,y1); line(x1,y1,x1,y2); setcolor(8); line(x2,y1,x2,y2); line(x1,y2,x2,y2); setfillstyle(1,7); bar(x1+1,y1+1,x2-1,y2-1); int x = ctextx(x1,x2,Caption); int y = ctexty(y1,y2); setcolor(0); outtextxy(x,y,Caption); } void buttonDown(int x1,int y1,int x2,int y2,char * Caption){ setcolor(8); line(x1,y1,x2,y1); line(x1,y1,x1,y2); setcolor(15); line(x2,y1,x2,y2); line(x1,y2,x2,y2); setfillstyle(1,7); bar(x1+1,y1+1,x2-1,y2-1); int x = ctextx(x1,x2,Caption); int y = ctexty(y1,y2); setcolor(0); outtextxy(x,y,Caption); } void buttonselect(int x1,int y1,int x2,int y2,char * Caption){ setcolor(15); line(x1,y1,x2,y1); line(x1,y1,x1,y2); setcolor(8); line(x2,y1,x2,y2); line(x1,y2,x2,y2); int x = ctextx(x1,x2,Caption); int y = ctexty(y1,y2); setfillstyle(1,9); bar(x1 + 3,y1 + 3,x2 - 3,y2 - 3); setcolor(0); outtextxy(x,y,Caption); } void kill_words(int x1,int y1,int x2,int y2){ setfillstyle(1,7); bar(x1,y1,x2,y2); } int cwinx(int x){ int ox; ox = 640 - x; return ox; } int cwiny(int y){ int oy; oy = 480 - y; return oy; } void textbox(int x1,int y1,int x2,int y2,int bcolor,int wc,char * Caption){ fillbox_3D_Down(x1,y1,x2,y2,bcolor); setcolor(wc); int x = ctextx(x1,x2,Caption); int y = ctexty(y1,y2); outtextxy(x,y,Caption); } void ProgressBar(int x1,int y1,int x2,int y2,int bcolor,int c ,int value){ fillbox_3D_Down(x1,y1,x2,y2,bcolor); int howlong = (x2 - x1) / 100; setfillstyle(1,c); if(x1+3+howlong * value >= x2){ bar(x1+3,y1+3,x1-3+howlong * value,y2-3); } else{ bar(x1+3,y1+3,x1+3+howlong * value,y2-3); } } void copy(int x1,int y1,int x2,int y2,int c,char * file1, char * file2){ FILE * oldfile, * newfile; struct ffblk ffblk; long howlong = 0; long flag = 0; long bytes = 0; int b = 0; oldfile = fopen(file1,"rb"); newfile = fopen(file2,"wb"); int done = findfirst(file1,&ffblk,0); while(!done){ howlong = howlong + ffblk.ff_fsize; done = findnext(&ffblk); } bytes = howlong / 100; do { fputc(fgetc(oldfile),newfile); flag = flag + 1; if(flag / bytes == 1){ flag = 0; b = b + 1; ProgressBar(x1,y1,x2,y2,7,c,b); } }while(!feof(oldfile)); fclose(oldfile); fclose(newfile); }

搜索更多相关主题的帖子: 源代码 dos 初中 见笑 
2005-04-17 11:27
yuki
Rank: 2
等 级:新手上路
威 望:5
帖 子:508
专家分:0
注 册:2005-2-4
收藏
得分:0 

/* Setup.Cpp */ #include "app1.h"

void mainmenu(void); void findfile(char * fp); void text(int flag); void select(void); void helpmessage(void); void programemain(void); void quittodos(void); void fhd(void); void fnf(void); void searchDospath(void); void searchToolspath(void); void searchMyDospath(void); void wautoexec(void); void wconfig(void); void installDos(void); void installTools(void); void installMyDos(void); void enoughspace(void);

main(int argc,char * argv[]){ if(argc == 1){ initDrv(); programemain(); } else if(argc == 2 && !strcmp(argv[1],"/v")){ textmode(C80); textcolor(15|128); cprintf("BootDisk"); textcolor(9); cprintf(" Version"); textcolor(2|128); cprintf(" 2000 "); textcolor(9); cprintf("by GoodJob studio\n"); int y = wherey(); gotoxy(1,y); cprintf("Writer : Yu Sheng"); textmode(-1); exit(1); } else if(argc == 2 && !strcmp(argv[1],"/?")){ printf("BootDisk Version 2000.\n"); printf("/v To see the BootDisk Version\n"); printf("/fhd To format HardDisk\n"); printf("/id To install Dos\n"); printf("/it To install Tools\n"); printf("/imd To install MyDos\n"); printf("/? To see Quick Help"); } else if(argc == 2 && !strcmp(argv[1],"/fhd")){ fhd(); } else if(argc == 2 && !strcmp(argv[1],"/id")){ initDrv(); installDos(); } else if(argc == 2 && !strcmp(argv[1],"/it")){ initDrv(); installTools(); } else if(argc == 2 && !strcmp(argv[1],"/imd")){ initDrv(); installMyDos(); } else{ initDrv(); programemain(); } return 0; }

void mainmenu(void){ draw_win_3D(50,50,cwinx(50),cwiny(50),1,"BootDisk Version 2000 Install Menu",2); textbox(55,400,585,425,7,6,"Welcome to use BootDisk Version 2000"); setcolor(5); settextstyle(1,1,7); outtextxy(100,100,"BootDisk"); setcolor(4); settextstyle(5,0,5); outtextxy(265,75,"Selected Menu"); settextstyle(0,0,1); buttonselect(275,155,490,185,"Format HardDisk"); buttonUp(275,190,490,220,"Install Dos"); buttonUp(275,225,490,255,"Install Tools"); buttonUp(275,260,490,290,"Install My Dos"); buttonUp(275,295,490,325,"About BootDisk"); buttonUp(275,330,490,360,"Exit"); } void text(int flag){ if(flag == 1){ textbox(55,400,585,425,7,6,"To format your HardDisk"); } else if(flag == 2){ textbox(55,400,585,425,7,6,"To install Microsoft Dos 6.22"); } else if(flag == 3){ textbox(55,400,585,425,7,6,"To install some tools"); } else if(flag == 4){ textbox(55,400,585,425,7,6,"We develop some tools for MS-DOS"); } else if(flag == 5){ textbox(55,400,585,425,7,6,"To see BootDisk about information"); } else if(flag == 6){ textbox(55,400,585,425,7,6,"Exit to Dos"); } } void select(void){ int flag = 1; int key; char Redo = 'Y'; while(Redo == 'Y'){ Redo = 'N'; key = bioskey(0); switch(key){ case UPKEY: if(flag == 1){ buttonUp(275,155,490,185,"Format HardDisk"); buttonselect(275,330,490,360,"Exit"); flag = 6; Redo = 'Y';

} else if(flag == 2){ buttonUp(275,190,490,220,"Install Dos"); buttonselect(275,155,490,185,"Format HardDisk"); flag = 1; Redo = 'Y';

} else if(flag == 3){ buttonUp(275,225,490,255,"Install Tools"); buttonselect(275,190,490,220,"Install Dos"); flag = 2; Redo = 'Y';

} else if(flag == 4){ buttonUp(275,260,490,290,"Install My Dos"); buttonselect(275,225,490,255,"Install Tools"); flag = 3; Redo = 'Y';

} else if(flag == 5){ buttonUp(275,295,490,325,"About BootDisk"); buttonselect(275,260,490,290,"Install My Dos"); flag = 4; Redo = 'Y';

} else if(flag == 6){ buttonUp(275,330,490,360,"Exit"); buttonselect(275,295,490,325,"About BootDisk"); flag = 5; Redo = 'Y';

} text(flag); break; case DOWNKEY: if(flag == 1){ buttonUp(275,155,490,185,"Format HardDisk"); buttonselect(275,190,490,220,"Install Dos"); flag = 2; Redo = 'Y';

} else if(flag == 2){ buttonUp(275,190,490,220,"Install Dos"); buttonselect(275,225,490,255,"Install Tools"); flag = 3; Redo = 'Y';

} else if(flag == 3){ buttonUp(275,225,490,255,"Install Tools"); buttonselect(275,260,490,290,"Install My Dos"); flag = 4; Redo = 'Y';

} else if(flag == 4){ buttonUp(275,260,490,290,"Install My Dos"); buttonselect(275,295,490,325,"About BootDisk"); flag = 5; Redo = 'Y';

} else if(flag == 5){ buttonUp(275,295,490,325,"About BootDisk"); buttonselect(275,330,490,360,"Exit"); flag = 6; Redo = 'Y';

} else if(flag == 6){ buttonUp(275,330,490,360,"Exit"); buttonselect(275,155,490,185,"Format HardDisk"); flag = 1; Redo = 'Y';

} text(flag); break; case ENTER : if(flag == 6){ quittodos(); } else if(flag == 5){ buttonDown(275,295,490,325,"About BootDisk"); delay(150); buttonUp(275,295,490,325,"About BootDisk"); delay(150); helpmessage(); } else if(flag == 1){ buttonDown(275,155,490,185,"Format HardDisk"); delay(150); buttonUp(275,155,490,185,"Format HardDisk"); delay(150); fhd(); } else if(flag == 2){ buttonDown(275,190,490,220,"Install Dos"); delay(150); buttonUp(275,190,490,220,"Install Dos"); delay(150); installDos(); } else if(flag == 3){ buttonDown(275,225,490,255,"Install Tools"); delay(150); buttonUp(275,225,490,255,"Install Tools"); delay(150); installTools(); } else if(flag == 4){ buttonDown(275,260,490,290,"Install My Dos"); delay(150); buttonUp(275,260,490,290,"Install My Dos"); delay(150); installMyDos(); } break; case ESC : closegraph(); exit(1); break; case F1 : helpmessage(); break; default : Redo = 'Y'; } } } void quittodos(void){ buttonDown(275,330,490,360,"Exit"); delay(150); buttonUp(275,330,490,360,"Exit"); delay(150); closeDrv(); exit(1); } void findfile(char * fp){ FILE * file; if((file = fopen(fp,"rb")) == NULL){ draw_win_3D(200,160,450,315,1,"Error",4); setcolor(0); int x = ctextx(200,450,"Cannot find file"); int y = ctexty(160,315); outtextxy(x,y - 10,"Cannot find file"); setcolor(4); x = ctextx(200,450,fp); outtextxy(x,y,fp); auto_line(205,275,445,275); buttonselect(284,285,365,306,"Continue"); getch(); buttonDown(284,285,365,305,"Continue"); delay(150); buttonselect(284,285,365,306,"Continue"); delay(150); programemain(); } fclose(file); } void helpmessage(void){ draw_win_3D(200,160,450,315,1,"About BootDisk",2); setcolor(0); int x = ctextx(200,450,"BootDisk Version 2000"); outtextxy(x,200,"BootDisk Version 2000"); outtextxy(x,210," by GoodJob studio "); outtextxy(x,220," writer Yu Sheng "); setcolor(9); outtextxy(x-20,245,"Email Address:"); outtextxy(x+30,255,"goldyu@online.sh.cn"); auto_line(205,275,445,275); buttonselect(284,285,365,306,"Continue"); getch(); buttonDown(284,285,365,305,"Continue"); delay(150); buttonselect(284,285,365,306,"Continue"); delay(150); programemain(); } void programemain(void){ mainmenu(); select(); } void fnf(void){ draw_win_3D(200,160,450,315,1,"Error",4); setcolor(0); int x = ctextx(200,450,"Cannot find file format.com"); int y = ctexty(160,310); outtextxy(x,y,"Cannot find file format.com"); auto_line(205,275,445,275); buttonselect(284,285,365,306,"Continue"); getch(); buttonDown(284,285,365,305,"Continue"); delay(150); buttonselect(284,285,365,306,"Continue"); delay(150); programemain(); } void fhd(void){ FILE * fp; if((fp = fopen("Format.com","rb")) == NULL){ fnf(); } else{ closeDrv(); system("format c:/q/u/s/v:GoodJob"); initDrv(); programemain(); } fclose(fp); } void installDos(void){ draw_win_3D(150,140,500,315,1,"Install Dos",2); int x = ctextx(160,490,"Please wait a moment."); setcolor(0); outtextxy(x,180,"Please wait a moment"); x = ctextx(160,490,"it will updata your computer system"); outtextxy(x,195,"it will updata your computer system"); outtextxy(163,210,"After that,it will install MS-DOS on your"); outtextxy(163,225,"computer,it takes you only a few minutes."); setcolor(1); enoughspace(); searchDospath(); findfile("mscdex.exe"); x = ctextx(160,490,"Source File A:\\mscdex.exe"); outtextxy(x,240,"Source File A:\\mscdex.exe"); x = ctextx(160,490,"To C:\\dos\\mscdex.exe"); outtextxy(x,250,"To C:\\dos\\mscdex.exe"); copy(175,270,475,290,1,"mscdex.exe","c:\\dos\\mscdex.exe"); kill_words(170,240,480,260); setcolor(1); findfile("chkdsk.exe"); x = ctextx(160,490,"Source File A:\\chkdsk.exe"); outtextxy(x,240,"Source File A:\\chkdsk.exe"); x = ctextx(160,490,"To C:\\dos\\chkdsk.exe"); outtextxy(x,250,"To C:\\dos\\chkdsk.exe"); copy(175,270,475,290,1,"chkdsk.exe","c:\\dos\\chkdsk.exe"); kill_words(170,240,480,260); setcolor(1); findfile("cdrom.sys"); x = ctextx(160,490,"Source File A:\\cdrom.sys"); outtextxy(x,240,"Source File A:\\cdrom.sys"); x = ctextx(160,490,"To C:\\dos\\cdrom.sys"); outtextxy(x,250,"To C:\\dos\\cdrom.sys"); copy(175,270,475,290,1,"cdrom.sys","c:\\dos\\cdrom.sys"); kill_words(170,240,480,260); setcolor(1); findfile("fdisk.exe"); x = ctextx(160,490,"Source File A:\\fdisk.exe"); outtextxy(x,240,"Source File A:\\fdisk.exe"); x = ctextx(160,490,"To C:\\dos\\fdisk.exe"); outtextxy(x,250,"To C:\\dos\\fdisk.exe"); copy(175,270,475,290,1,"fdisk.exe","c:\\dos\\fdisk.exe"); kill_words(170,240,480,260); setcolor(1); findfile("format.com"); x = ctextx(160,490,"Source File A:\\format.com"); outtextxy(x,240,"Source File A:\\format.com"); x = ctextx(160,490,"To C:\\dos\\format.com"); outtextxy(x,250,"To C:\\dos\\format.com"); copy(175,270,475,290,1,"format.com","c:\\dos\\format.com"); kill_words(170,240,480,260); setcolor(1); findfile("smartdrv.exe"); x = ctextx(160,490,"Source File A:\\smartdrv.exe"); outtextxy(x,240,"Source File A:\\smartdrv.exe"); x = ctextx(160,490,"To C:\\dos\\smartdrv.exe"); outtextxy(x,250,"To C:\\dos\\smartdrv.exe"); copy(175,270,475,290,1,"smartdrv.exe","c:\\dos\\smartdrv.exe"); kill_words(170,240,480,260); setcolor(1); findfile("hdformat.exe"); x = ctextx(160,490,"Source File A:\\hdformat.exe"); outtextxy(x,240,"Source File A:\\hdformat.exe"); x = ctextx(160,490,"To C:\\dos\\hdformat.exe"); outtextxy(x,250,"To C:\\dos\\hdformat.exe"); copy(175,270,475,290,1,"hdformat.exe","c:\\dos\\hdformat.exe"); kill_words(170,240,480,260); setcolor(1); findfile("deltree.exe"); x = ctextx(160,490,"Source File A:\\deltree.exe"); outtextxy(x,240,"Source File A:\\deltree.exe"); x = ctextx(160,490,"To C:\\dos\\deltree.exe"); outtextxy(x,250,"To C:\\dos\\deltree.exe"); copy(175,270,475,290,1,"deltree.exe","c:\\dos\\deltree.exe"); kill_words(170,240,480,260); setcolor(1); findfile("himem.sys"); x = ctextx(160,490,"Source File A:\\himem.sys"); outtextxy(x,240,"Source File A:\\himem.sys"); x = ctextx(160,490,"To C:\\dos\\himem.sys"); outtextxy(x,250,"To C:\\dos\\himem.sys"); copy(175,270,475,290,1,"himem.sys","c:\\dos\\himem.sys"); kill_words(170,240,480,260); setcolor(1); findfile("sys.com"); x = ctextx(160,490,"Source File A:\\sys.com"); outtextxy(x,240,"Source File A:\\sys.com"); x = ctextx(160,490,"To C:\\dos\\sys.com"); outtextxy(x,250,"To C:\\dos\\sys.com"); copy(175,270,475,290,1,"sys.com","c:\\dos\\sys.com"); kill_words(170,240,480,260); setcolor(1); findfile("dos.exe"); x = ctextx(160,490,"Source File A:\\dos.exe"); outtextxy(x,240,"Source File A:\\dos.exe"); x = ctextx(160,490,"To C:\\dos\\dos.exe"); outtextxy(x,250,"To C:\\dos\\dos.exe"); copy(175,270,475,290,1,"dos.exe","c:\\dos\\dos.exe"); kill_words(170,240,480,260); setcolor(1); x = ctextx(160,490,"Decompression Files"); outtextxy(x,245,"Decompression Files"); system("c:"); system("cd\\dos"); system("dos > NUL"); unlink("dos.exe"); system("a:"); kill_words(170,240,480,260); setcolor(1); x = ctextx(160,490,"Write autoexec.bat"); outtextxy(x,245,"Write autoexec.bat"); wautoexec(); delay(250); kill_words(170,240,480,260); setcolor(1); x = ctextx(160,490,"Write config.sys"); outtextxy(x,245,"Write config.sys"); wconfig(); delay(250); programemain(); } void installTools(void){ draw_win_3D(150,140,500,315,1,"Install Dos",2); int x = ctextx(160,490,"Please wait a moment."); setcolor(0); outtextxy(x,180,"Please wait a moment"); x = ctextx(160,490,"it will updata your computer system"); outtextxy(x,195,"it will updata your computer system"); outtextxy(163,210,"After that,it will install Tools on your"); outtextxy(163,225,"computer,it takes you only a few minutes."); setcolor(1); enoughspace(); searchToolspath(); findfile("Tools.exe"); x = ctextx(160,490,"Source File A:\\Tools.exe"); outtextxy(x,240,"Source File A:\\Tools.exe"); x = ctextx(160,490,"To C:\\tools\\Tools.exe"); outtextxy(x,250,"To C:\\tools\\Tools.exe"); copy(175,270,475,290,1,"tools.exe","c:\\tools\\tools.exe"); kill_words(170,240,480,260); setcolor(1); x = ctextx(160,490,"Decompression Files"); outtextxy(x,245,"Decompression Files"); system("c:"); system("cd\\tools"); system("tools > NUL"); unlink("tools.exe"); system("a:"); programemain(); }


我们都在命运湖上荡舟划桨,波浪起伏使我们无法逃离孤行;如果我们迷失方向,波浪将指引我们穿过另一天曙光
2005-04-17 11:28
yuki
Rank: 2
等 级:新手上路
威 望:5
帖 子:508
专家分:0
注 册:2005-2-4
收藏
得分:0 
void installMyDos(void){
     draw_win_3D(150,140,500,315,1,"Install Dos",2);
     int x = ctextx(160,490,"Please wait a moment.");
     setcolor(0);
     outtextxy(x,180,"Please wait a moment");
     x = ctextx(160,490,"it will updata your computer system");
     outtextxy(x,195,"it will updata your computer system");
     outtextxy(163,210,"After that,it will install MyDos on your");
     outtextxy(163,225,"computer,it takes you only a few minutes.");
     setcolor(1);
     enoughspace();
     searchMyDospath();
     findfile("mydos.exe");
     x = ctextx(160,490,"Source File A:\\Mydos.exe");
     outtextxy(x,240,"Source File A:\\Mydos.exe");
     x = ctextx(160,490,"To C:\\mydos\\Mydos.exe");
     outtextxy(x,250,"To C:\\mydos\\Mydos.exe");
     copy(175,270,475,290,1,"mydos.exe","c:\\mydos\\mydos.exe");
     kill_words(170,240,480,260);
     setcolor(1);
     x = ctextx(160,490,"Decompression Files");
     outtextxy(x,245,"Decompression Files");
     system("c:");
     system("cd\\mydos");
     system("mydos &gt; NUL");
     unlink("mydos.exe");
     system("a:");
     programemain();
}
void searchDospath(void){
     char * p;
     system("c:");
     system("cd\\");
     p = searchpath("Dos");
     if(p == NULL){
 mkdir("c:\\dos");
 system("a:");
     }
     else{
 system("cd\\dos");
 struct ffblk ffblk;
 int done = findfirst("*.*",&amp;ffblk,0);
 while(!done){
      unlink(ffblk.ff_name);
      done = findnext(&amp;ffblk);
 }
 system("cd\\");
 system("a:");
     }
}
void searchToolspath(void){
     char * p;
     system("c:");
     system("cd\\");
     p = searchpath("Tools");
     if(p == NULL){
 mkdir("c:\\tools");
 system("a:");
     }
     else{
 system("cd\\tools");
 struct ffblk ffblk;
 int done = findfirst("*.*",&amp;ffblk,0);
 while(!done){
      unlink(ffblk.ff_name);
      done = findnext(&amp;ffblk);
 }
 system("cd\\");
 system("a:");
     }
}
void searchMyDospath(void){
     char * p;
     system("c:");
     system("cd\\");
     p = searchpath("MyDos");
     if(p == NULL){
 mkdir("c:\\mydos");
 system("a:");
     }
     else{
 system("cd\\mydos");
 struct ffblk ffblk;
 int done = findfirst("*.*",&amp;ffblk,0);
 while(!done){
      unlink(ffblk.ff_name);
      done = findnext(&amp;ffblk);
 }
 system("cd\\");
 system("a:");
     }
}
void enoughspace(void){
     struct dfree free;
     long avail;
     int drive;
     system("c:");
     drive = getdisk();
     getdfree(drive+1, &amp;free);
     if (free.df_sclus == 0xFFFF){
 draw_win_3D(200,160,450,315,1,"Error",4);
 setcolor(0);
 int x = ctextx(200,450,"Internal command error");
 int y = ctexty(160,310);
 outtextxy(x,y,"Internal command error");
 auto_line(205,275,445,275);
 buttonselect(284,285,365,306,"Continue");
 getch();
 buttonDown(284,285,365,305,"Continue");
 delay(150);
 buttonselect(284,285,365,306,"Continue");
 delay(150);
 system("a:");
 programemain();
     }
     avail =  (long) free.df_avail
      * (long) free.df_bsec
      * (long) free.df_sclus;
     struct ffblk ffblk;
     int done = findfirst("a:\\*.*",&amp;ffblk,0);
     long howlong = 0;
     while(!done){
   howlong = howlong + ffblk.ff_fsize;
   done = findnext(&amp;ffblk);
     }
     if(avail &lt; howlong){
 draw_win_3D(200,160,450,315,1,"Error",4);
 setcolor(0);
 int x = ctextx(200,450,"Not enough space");
 int y = ctexty(160,310);
 outtextxy(x,y,"Not enough space");
 auto_line(205,275,445,275);
 buttonselect(284,285,365,306,"Continue");
 getch();
 buttonDown(284,285,365,305,"Continue");
 delay(150);
 buttonselect(284,285,365,306,"Continue");
 delay(150);
 system("a:");
 programemain();
     }
     else{
 system("a:");
     }
}
void wautoexec(void){
     FILE * autoexec;
     autoexec = fopen("c:\\autoexec.bat","w+");
     fprintf(autoexec,"@ECHO OFF\n");
     fprintf(autoexec,"SET DIRCMD=/W/P/L/OD\n");
     fprintf(autoexec,"PATH C:\\DOS;C:\\TOOLS;C:\\MYDOS;C:\\ \n");
     fprintf(autoexec,"SET TEMP=C:\\TEMP\n");
     fprintf(autoexec,"LH C:\\DOS\\\n");
     fprintf(autoexec,"LH C:\\DOS\\MSCDEX.EXE /D:IDECD001 /V /M:1\n");
     fprintf(autoexec,"LH C:\\DOS\\SMARTDRV.EXE\n");
     fprintf(autoexec,"CLS");
     fclose(autoexec);
}
void wconfig(void){
     FILE * config;
     config = fopen("c:\\config.sys","w+");
     fprintf(config,"DOS=HIGH,UMB\n");
     fprintf(config,"STACKS=9,265\n");
     fprintf(config,"LASTDRIVE=F\n");
     fprintf(config,"FILES=40\n");
     fprintf(config,"BUFFERS=30,0\n");
     fprintf(config,"DEVICE=C:\\DOS\\HIMEM.SYS /TESTMEM:OFF /SHADOWRAM:ON\n");
     fprintf(config,"DEVICE=C:\\DOS\\EMM386.EXE NOEMS\n");
     fprintf(config,"DEVICEHIGH=C:\\DOS\\CDROM.SYS /D:IDECD001");
     fclose(config);
}

我们都在命运湖上荡舟划桨,波浪起伏使我们无法逃离孤行;如果我们迷失方向,波浪将指引我们穿过另一天曙光
2005-04-17 11:28
yuki
Rank: 2
等 级:新手上路
威 望:5
帖 子:508
专家分:0
注 册:2005-2-4
收藏
得分:0 
当时并不清楚结构和指针的概念,所以代码看上去比较繁琐。。。
但至今还是不太会使用结构,继续努力学习,高手见笑了。。。

我们都在命运湖上荡舟划桨,波浪起伏使我们无法逃离孤行;如果我们迷失方向,波浪将指引我们穿过另一天曙光
2005-04-17 11:30
神vLinux飘飘
Rank: 13Rank: 13Rank: 13Rank: 13
来 自:浙江杭州
等 级:贵宾
威 望:91
帖 子:6140
专家分:217
注 册:2004-7-17
收藏
得分:0 
啊啊啊.是不是啊,没骗人吧,
我找了大半个网络都没找到DOS的源代码
你这个是不是真得啊 !!!!!!


激动ing
不是我要杀人的啊!!!

啊啊 啊 啊太激动了!

淘宝杜琨
2005-04-17 18:30
Knocker
Rank: 8Rank: 8
等 级:贵宾
威 望:47
帖 子:10454
专家分:603
注 册:2004-6-1
收藏
得分:0 
为什么不问问我这个踏遍整个网络的KNOCKER??? 不过是要花钱的 [UseMoney=5000]http://www.20cn.net/cgi-bin/download/down.cgi?down=http://www.20cn.net/download/Src/Dos_src.zip[/UseMoney]

九洲方除百尺冰,映秀又遭蛮牛耕。汽笛嘶鸣国旗半,哀伤尽处是重生。     -老K
治国就是治吏。礼义廉耻,国之四维。四维不张,国之不国。   -毛泽东
2005-04-17 19:24
yukk
Rank: 1
等 级:新手上路
帖 子:29
专家分:0
注 册:2005-3-7
收藏
得分:0 
555555555我还是看程序好吃力啊。
2005-04-18 00:17
musicml
Rank: 1
等 级:新手上路
帖 子:273
专家分:0
注 册:2005-4-2
收藏
得分:0 
一个字,强!

Every thing is possible.
2005-04-18 12:07
murongsue
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2005-4-21
收藏
得分:0 
头晕   

C 语言诗人
2005-04-21 02:28
lycnsc
Rank: 1
等 级:新手上路
帖 子:243
专家分:0
注 册:2005-3-27
收藏
得分:0 
初中就写这个?强!猛!佩服!
2005-04-21 09:22
快速回复:念初中时编的dos 6.22启动盘源代码,现在好像不用了,把原码贴出来,高 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.033198 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved