Hi to all Could we use the Int 13h (direct disk read/write) in Windows operating systems or does the windows protected mode not allow us, and if so is there a work round? Thanks in advance.
Gosh, I hope so. It would be a boon for virus writers everywhere.
No, The Windows sub-system, upon initialization during boot, would have reconfigured the BIOS interrupt handling for the kernel as the BIOS calls are 16bit, not protected mode and hence int 13h would be invalid. That is the reason why there are drivers which are written for 32bit protected mode which bypasses the BIOS completely.
Which begs the question - why are you trying to do that?
Windows will kill your code on any attempt to communicate with the BIOS as if saying 'Hey, you code, you talk to me as the Windows Boss, you cannot bypass me, mwuah ha ha DO NOT TREAD ON OUTSIDE MY DOMAIN'.
The only time int 13h would be used would be during boot stage BEFORE windows loads or if you are using MSDOS as the system i.e. no windows, just boot into MSDOS, then the int 13h would be valid to use. In both cases, they would be 16bit mode and hence the BIOS would be accessible.
There is a common interrupt 0x2E I believe, that is the kernel's system call, as far as I know.
In short, I would not recommend trying to bypass the Windows system, that is why there is a such thing as a driver to do that for you, you would be better off to interact with the driver as part of the disk i/o subsystem and let that handle it for you.
Hope this helps, Best regards, Tom.
With the right permissions (administrator has them), you can use Win32 CreateFile and related functions to access physical drives and logical partitions directly. See the MSDN documentation.
As others have mentioned it won't work unless you are using 16 bit - MSDOS, but if you are on a 32 bit system and have debug.exe you could try it for yourself. (You may crash your OS!) Simply enter the commands mov ax, etc.. int 13h etc.. then execute it.