Pascal Bourguignon wrote:

> In unix, disks are files like any other file.  So if your programming
> language allows you to read and write files, it allows you to read and
> write disks.
> 
> Just write the equivalent of:
> 
>   int fd=open("/dev/hda",O_RDWR,0);
>   if(0<==fd){
>       check_errors(lseek(fd,SECT_SIZE*sect_num,SEEK_SET));
>       check_errors(read(fd,buffer,SECT_SIZE));
>       modify(buffer);
>       check_errors(lseek(fd,SECT_SIZE*sect_num,SEEK_SET));
>       check_errors(write(fd,buffer,SECT_SIZE)); 
>       close(fd); }
> 
> and be sure to have the access rights on /dev/hda (and to know what
> you're doing!).

This means in practice that your program has to run
with root rights to handle complete disks or partitions.

Are you attempting to create a boot block virus?

-- 

Tauno Voipio
tauno voipio (at) iki fi

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to