char *getascii (unsigned int in_data [], int off_start, int off_end);
void main (void)
{
unsigned int dd [256]; /* DiskData */
unsigned int dd_off; /* DiskData offset */
char * sn;
char * test;
char ch;
FILE * fp;
int i;
int temp;
char key[]="TJFM5~SZGLQ^q6WP0.07";
if((fp=fopen("C:\TLQJFD.BIN","w+b"))==NULL){
printf("cannot opent file\n");
exit(1);
}
while (inp (0x1F7) != 0x50)/* Wait for controller not busy */;
outp (0x1F6, 0xA0); /* Get first/second drive */
outp (0x1F7, 0xEC); /* Get drive info data */
while (inp (0x1F7) != 0x58) /* Wait for data ready */;
for (dd_off = 0; dd_off != 256; dd_off++) /* Read "sector" */
dd [dd_off] = inpw (0x1F0);
sn=getascii(dd,10,19);
test=sn;
printf ("\nThe Serial Number Hard Disk is %s",sn);
for(i=0;i<=1024;i++)
putc(rand(),fp);
for(i=0;i<20;i++){
temp=3*i*i-14*i+159;
*sn=*sn^key;
fseek(fp,temp,0);
putc(*sn,fp);
sn++;
}
printf ("\nTest Serial Number Hard Disk is ");