| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 905 人关注过本帖
标题:以前写的一个保存/恢复CMOS和给GHOST改IP的程序
只看楼主 加入收藏
yywyai
Rank: 1
等 级:新手上路
帖 子:30
专家分:0
注 册:2004-12-9
收藏
 问题点数:0 回复次数:1 
以前写的一个保存/恢复CMOS和给GHOST改IP的程序

;以前写的一个保存/恢复CMOS和给GHOST改IP的程序,以前写程序没有写注释的习惯,有注释的地方是现在加上去的。

.model small .386 .stack 64 .data filehandle dw ? filename db '\wattcp.cfg',0 cfgname db '\wy.dat',0 cmosfile db '\cmos.dat',0 cfg1 db 'IP = ' buf1 db 16,0,15 dup(' '),0dh,0ah cfg2 db 'NETMASK = ' buf2 db 16,0,15 dup(' '),0dh,0ah cfg3 db 'GATWAY = ' buf3 db 16,0,15 dup(' '),0dh,0ah buf4 db 3,0,2 dup(0) readbuf db 50 dup(0) read db 0 fleg db 0 fleg1 db 0 writebuf db ' ',' ',' ','$' msg1 db 0dh,0ah,'Enter IP:','$' msg2 db 0dh,0ah,'Enter NetMask:','$' msg3 db 0dh,0ah,'Enter GatWay:','$' msg4 db 0dh,0ah,'Enter max N','$' msg5 db 0dh,0ah,'Modify IP success!','$' msg6 db 0dh,0ah,'Are you sure?(y/n)','$' msg7 db 0dh,0ah,'Input the number between 0 and 99!','$' err1 db 0dh,0ah,'Open file error!','$' err2 db 0dh,0ah,'Write file error!','$' display1 db 0dh,0ah,' compile this program by wangyong. ~b_b~ ' db 0dh,0ah db 0dh,0ah db 0dh,0ah,' enter /? for help.' db 0dh,0ah,' /s for save cmos and modif ip.' db 0dh,0ah,' /r for resume cmos and modif ip.' db 0dh,0ah,' /or for resume cmos olny.' db 0dh,0ah,' /os for save cmos olny.' db 0dh,0ah,' if no parameter,you can modify ip only.' db 0dh,0ah db 0dh,0ah db 0dh,0ah,' ver3.0','$' perror db 0dh,0ah,'parameter error.','$' cmd db 0 .code start proc far cld mov si,82h ;以下是对参数的判断 lodsb cmp al,'/' jnz goip mov si,83h lodsw push ax mov ax,@data mov ds,ax pop ax cmp al,'?' jz help cmp al,'s' jz save cmp al,'r' jz resume cmp ax,'so' jz onlysave cmp ax,'ro' jz onlyresume jmp perr save: mov fleg1,1 onlysave: clc lea dx,cmosfile call creatfile jc error2 mov dl,0 cg mov al,dl push dx call savecmos mov cx,1 lea dx,cmd mov bx,filehandle call writefile jc error2 pop dx inc dl cmp dl,170 jnz cgo call closefile cmp fleg1,1 jnz exit jmp goip onlyresume: mov fleg1,2 resume: lea dx,cmosfile call openfile jc error1 mov dl,0 rg push dx mov cx,1 lea dx,cmd call readfile jc error1 pop dx mov al,dl call resumecmos inc dl cmp dl,170 jnz rgo call closefile cmp fleg1,2 jz exit jmp goip help: mov ah,09h lea dx,display1 int 21h jmp exit perr: mov ax,@data mov ds,ax lea dx,perror mov ah,09h int 21h cmp fleg1,2 jz exit goip: mov ax,@data mov ds,ax lea dx,cfgname call openfile jc nofile mov cx,1 lea dx,read call readfile jc error1 cmp read,0 jz nofile mov fleg,'y' mov al,read mov ah,01h sub al,ah das mov read,al call closefile lea dx,cfgname call delwy jmp creat1 writ: mov cx,1 lea dx,read call writefile jc error2 jmp go nofile: call ent mov al,buf4+2 mov read,al creat1: lea dx,cfgname call creatfile jc error2 jmp writ error1: mov ah,09h lea dx,err1 int 21h jmp exit error2: mov ah,09h lea dx,err2 int 21h jmp exit creat2: lea dx,filename call creatfile jc error2 cmp fleg,'y' je write1 jmp write2 g call closefile lea dx,filename call openfile jc creat2 cmp fleg,'y' jne creat2 jmp cont write1: call ent write2: mov cx,5 lea dx,cfg1 call writefile mov cx,17 lea dx,buf1+2 call writefile mov cx,10 lea dx,cfg2 call writefile mov cx,17 lea dx,buf2+2 call writefile mov cx,9 lea dx,cfg3 call writefile mov cx,17 lea dx,buf3+2 call writefile cont: mov cx,0 mov dx,5 call movefilepoint mov cx,15 lea dx,readbuf call readfile mov ax,@data mov es,ax mov cx,15 mov al,'.' lea di,readbuf repne scasb repne scasb repne scasb push cx mov al,read mov cl,4 shr al,cl or al,30h mov writebuf,al mov al,read and al,0fh or al,30h mov writebuf+1,al pop cx mov ax,15 sub ax,cx mov dx,ax add dx,5 mov cx,0 call movefilepoint mov cx,3 lea dx,writebuf call writefile call closefile mov ah,09h lea dx,msg5 int 21h exit: mov ax,4c00h int 21h start endp

creatfile proc near mov ah,3ch mov cx,0 int 21h jc ma mov filehandle,ax ma: ret creatfile endp

ent proc near wywy: lea dx,msg1 mov ah,09h int 21h mov ah,0ah lea dx,buf1 int 21h lea dx,msg2 mov ah,09h int 21h mov ah,0ah lea dx,buf2 int 21h lea dx,msg3 mov ah,09h int 21h mov ah,0ah lea dx,buf3 int 21h mov ah,09h lea dx,msg6 int 21h reb: mov ah,7 int 21h cmp al,'n' je wywy cmp al,'y' jne reb jmp mamade made: lea dx,msg7 mov ah,09h int 21h mamade: lea dx,msg4 mov ah,09h int 21h lea dx,buf4 mov ah,0ah int 21h cmp buf4+1,0 je mamade mov al,buf4+2 and al,0f0h cmp al,30h jne made cmp buf4+1,1 je next1 mov al,buf4+3 and al,0f0h cmp al,30h jne made and buf4+3,0fh mov cl,4 shl buf4+2,cl mov al,buf4+3 add al,buf4+2 daa mov buf4+2,al jmp next next1: and buf4+2,0fh next: cmp buf4+2,0 jz made ret ent endp

openfile proc near mov ax,3d02h int 21h jc haha mov filehandle,ax haha: ret openfile endp

readfile proc near clc mov bx,filehandle mov ah,3fh int 21h ret readfile endp

writefile proc near clc mov ah,40h mov bx,filehandle int 21h ret writefile endp

movefilepoint proc near mov ah,42h mov al,0 mov bx,filehandle int 21h ret movefilepoint endp

delwy proc near mov ah,41h int 21h ret delwy endp

closefile proc near mov bx,filehandle mov ah,3eh int 21h ret closefile endp

savecmos proc near ;这里是保存CMOS out 70h,al in al,71h mov cmd,al ret savecmos endp

resumecmos proc near ;恢复CMOS out 70h,al mov al,cmd out 71h,al ret resumecmos endp

end start

搜索更多相关主题的帖子: CMOS GHOST 保存 
2004-12-24 10:56
JackiceDanimLEE
Rank: 1
等 级:新手上路
帖 子:15
专家分:0
注 册:2004-12-25
收藏
得分:0 

我是一个菜,今天刚注册的。哈,居然就坐了沙发。谢谢~~ 谢谢~~

说实话,您写的我看不懂~

我努力~ 总会有一天会赶上。。。

您也继续努力。

以后还要大家不厌其烦的帮助我这个菜哦~ 谢谢~


-------------------- Jackice Danimoth LEE ------------------------------------------------------------------------------- 看贴不回的都是日本人. 我讨厌日本**,因为它们就不能算人.它们****.***********.***********.*********.
2004-12-25 19:28
快速回复:以前写的一个保存/恢复CMOS和给GHOST改IP的程序
数据加载中...
 
   



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

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