软件试用次数的限制
#include <sidio.h>
#include <dos.h>
#include <conio.h>
int count( )
{
union REGS inregs,outregs;
strut SREGS segs;
unsigned handle;
unsigned times;
/ * 打开文件 * /
inregs.h.ah =0x3d;
inregs.h.al =0;
scgread(& segs);
inregs.x.dx ="test.exe";
intdosx(& inregs, & outregs, & segs);
if(outregs.x.cflag) return(0);
else
{
/ * 读取文件日期时间 * /
handle = Outregs.x.ax;
inregs.x.ax = 0x5700;
inregs.x.bx = handle;
intdosx(& inregs, & outregs, &segs);
times = (outregs.x.cx &0x7e0)> > 5;
if(times <40)/ * 试用次数可以通过改变此处的'40'来实现 * /
{
inregs.x.ax = 0x5701;
inregs.x.bx = handle;
inregs.x.cx = outregs.x.cx + 0x20; / * 试用次数计数 * /
inregs.x.dx = outregs.x.dx;
intdosx(& inregs, & outregs, & segs); / * 重置日期时间 * /
return(2);
}
else return(1);
/ * 关闭文件 * /
inregs.h.ah = 0x3e;
inregs.x.bx = handle;
intdosx(& inregs, & outregs, & segs);
}
}
main()
{
int flag;
flag = count();
if(flag==0) printf("此软件为试用版,请勿任意修改!\ n");
if(flag==1) printf("此软件为试用版,您的试用次数已满!\n");
if(flag==2) printf("此软件为试用版,欢迎试用!\n");
}
//这是我从别的地方看到的!
但是不能用!在线请教!
#include <sidio.h>
没有这个头文件
REGS
没有这个类型!
或用别的方法实现软件试用次数的限制!
能解决的都有分!谢谢!