hi, all, i use the code below to read the first sector of per track of a hard disk from 0 to end. but it return before all of the sector had been readed.
the problem may happend in SetFilePointer, but i don't know why this happend! i hope you idea.
   

.WHILE TRUE
invoke ReadFile,hFile,offset ReceiveBuffer,512,offset Readed,NULL
invoke SendMessage,hwndPB,PBM_STEPIT,0,0
invoke SetFilePointer,hFile,8224768(head/track*head/sector-512),ADDR hi,FILE_BEGIN
.BREAK .IF eax==-1
Posted on 2004-11-29 04:23:38 by glass
Hi...

Your code seems to me correct...

You forgot to put .ENDW at the end...

I see only that like error...


.WHILE TRUE
invoke ReadFile,hFile,offset ReceiveBuffer,512,offset Readed,NULL
invoke SendMessage,hwndPB,PBM_STEPIT,0,0
invoke SetFilePointer,hFile,8224768,ADDR hi,FILE_BEGIN
.BREAK .IF eax==-1
.ENDW


You are obliged to work with TASM...to use Int21...with MASM one can't use Interrupts...

I don't know if one can use invoke with TASM????..

I let you...try to work with TASM because with MASM one can't use all the interrupts...

Good continuation....

Gerard...
--------------
Posted on 2004-12-06 02:18:00 by gerard
> You are obliged to work with TASM...to use Int21...with MASM one can't use Interrupts...

Could you please explain us what you are talking about!
Posted on 2004-12-06 04:45:55 by japheth
Hi...

If I well understood what you wanted to do...was to read sectors of a Hard disk...
If one wants to read sectors of a drive one must obligatory use Interrupts...
int 13,2 i.e. ah=02h...

Try to see a table of interrupts...

Before one can foind a such table at address---->


http://lrs.fmi.uni-passau.de/support/doc/interrupt-57/INT.HTM

http://lrs.fmi.uni-passau.de/support/doc/interrupt-57/INT-13.HTM

ANd to use these interrupts under Windows one must use [TASM and no MASM....

I think I enough well explained....

Good enjoy...

Gerard...
-------------
Posted on 2004-12-06 05:29:47 by gerard
Hi Gerard,

The interrupts are generally not available to Windows Ring 3 programming at all except a few that were left around for 9x. In reality MASM has absolutely no problem with interrupts but generally since they are used in DOS programming you must link using an older 16 bit linker. TASM, MASM or any other assembler will faithfully assemble any opcode so it makes no difference what assembler you use, however the linker must make a 16 bit executable because Win32 will not allow you to execute them in Ring3.
Posted on 2004-12-06 06:24:11 by donkey
> If one wants to read sectors of a drive one must obligatory use Interrupts

for the windows NT platform this isn't true. Instead you must use CreateFIle with "\\.\X:" as name. Search in the forum for more details.
Posted on 2004-12-06 07:53:53 by japheth
thanks to all. i opened the disk use CreatFile which supported in win2000/xp. i set file pointer use SetFilePointer and set distance 8224768
byte each time. when it set to about 520 times, then it return wrong. but 1-520, it run well.
Posted on 2004-12-06 12:08:08 by glass