OP wrote:
}in order to justify learning another language I'd first need to be
}convinced that python could easily do the following:-
}
}ReadSectors2Bu fr(hdx, StartSectr, SectrCnt, Bufr); <-- like linux:dd
}PrintDecOf4Byt es(Offset, Bufr); <-- and also 1 and 2 byte values
}OverWriteBufr( Offset, Bufr, Byte);
}WriteBufr2Sect ors ..... <-- like linux: dd
}
}I guess one would normally use bash, but I'd rather invest effort
}in python if it can do this.
}
}Thanks for any info.
-----------
Pascal Bourguignon wrote:[color=blue][color=green]
>> 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(ls eek(fd,SECT_SIZ E*sect_num,SEEK _SET));
>> check_errors(re ad(fd,buffer,SE CT_SIZE));
>> modify(buffer);
>> check_errors(ls eek(fd,SECT_SIZ E*sect_num,SEEK _SET));
>> check_errors(wr ite(fd,buffer,S ECT_SIZE)); close(fd); }
>> and be sure to have the access rights on /dev/hda (and to know
>> what you're doing!).[/color][/color]
Tauno Voipio wrote:[color=blue]
> Are you attempting to create a boot block virus?[/color]
Firstly, if you asked me advice on where to buy some goats-milk,
I'd answer in the context of where YOU stand now [especially
since you told me], NOT form where I'm standing.
For several reasons I need many partitions on my IDEs.
The one lost the chain of logical partitions at hdx26.
It's not linux, but that's not important.
The most convenient tool for ME [at my present status] to
read/write blocks is linux: dd; and to see/edit is linux:mc.
This involves a lot of tiring manual work.
I previously read of a contributor who automated the steps
of linux:fdisk [iterating through size guesses] inside of a bash
script, to recover his lost [last] partition.
I'm not keen on investing time to become more fluent in Bash,
which could drive dd.
I have other reasons to invest time in Python.
If Pyton could 'drive' dd, I would try it.
My normal OS is oberon S3, which can do better than the
C-code above, but I want to work at the highest level.
Understand ?
Thanks,
== Chris Glur.
}in order to justify learning another language I'd first need to be
}convinced that python could easily do the following:-
}
}ReadSectors2Bu fr(hdx, StartSectr, SectrCnt, Bufr); <-- like linux:dd
}PrintDecOf4Byt es(Offset, Bufr); <-- and also 1 and 2 byte values
}OverWriteBufr( Offset, Bufr, Byte);
}WriteBufr2Sect ors ..... <-- like linux: dd
}
}I guess one would normally use bash, but I'd rather invest effort
}in python if it can do this.
}
}Thanks for any info.
-----------
Pascal Bourguignon wrote:[color=blue][color=green]
>> 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(ls eek(fd,SECT_SIZ E*sect_num,SEEK _SET));
>> check_errors(re ad(fd,buffer,SE CT_SIZE));
>> modify(buffer);
>> check_errors(ls eek(fd,SECT_SIZ E*sect_num,SEEK _SET));
>> check_errors(wr ite(fd,buffer,S ECT_SIZE)); close(fd); }
>> and be sure to have the access rights on /dev/hda (and to know
>> what you're doing!).[/color][/color]
Tauno Voipio wrote:[color=blue]
> Are you attempting to create a boot block virus?[/color]
Firstly, if you asked me advice on where to buy some goats-milk,
I'd answer in the context of where YOU stand now [especially
since you told me], NOT form where I'm standing.
For several reasons I need many partitions on my IDEs.
The one lost the chain of logical partitions at hdx26.
It's not linux, but that's not important.
The most convenient tool for ME [at my present status] to
read/write blocks is linux: dd; and to see/edit is linux:mc.
This involves a lot of tiring manual work.
I previously read of a contributor who automated the steps
of linux:fdisk [iterating through size guesses] inside of a bash
script, to recover his lost [last] partition.
I'm not keen on investing time to become more fluent in Bash,
which could drive dd.
I have other reasons to invest time in Python.
If Pyton could 'drive' dd, I would try it.
My normal OS is oberon S3, which can do better than the
C-code above, but I want to work at the highest level.
Understand ?
Thanks,
== Chris Glur.
Comment