Page 1 of 2
DOS application don't work
Posted: Fri Apr 13, 2012 2:14 am
by 0x1f1
I write a DOS application that read the boot sector of a hard disk but this dont work and show a message saying that a application try to access directly the hard disk and is no support to this. Why this happens? How can I bypass this?
Re: DOS application don't work
Posted: Fri Apr 13, 2012 2:29 am
by Combuster
Try actually running DOS instead of Windows.
Re: DOS application don't work
Posted: Fri Apr 13, 2012 2:55 am
by bubach
I'm not sure about windows 64-bit version, but 32-bit xp allowed direct read/write with emulated int 13h code. in 32-bit windows 7 it might work if you right click the console/cmd.exe and "run as administrator" before executing the program.
Re: DOS application don't work
Posted: Fri Apr 13, 2012 3:32 am
by Yoda
bubach wrote:I'm not sure about windows 64-bit version...
64-bit versions won't run DOS apps at all, since Long mode doesn't support V86 mode.
Re: DOS application don't work
Posted: Fri Apr 13, 2012 4:56 am
by 0x1f1
My problem is that the DOS application that I write don't works because it use the INT 13h for read the sector of the hard disk.
What can I do to solve this problem in Windows 7, Vista and XP all of 32 bit and 64 bit?
Re: DOS application don't work
Posted: Fri Apr 13, 2012 5:19 am
by Thomas
Hi ,
What can I do to solve this problem in Windows 7, Vista and XP all of 32 bit and 64 bit?
Use CreateFile() , ReadFile() .. Win32 api functions .. . You generally do not use bios services in protected mode.
Best way would be to run dos in an emulator like Virtual PC if you want to run the application as such
--Thomas
Re: DOS application don't work
Posted: Fri Apr 13, 2012 9:58 am
by 0x1f1
I will tell you again what is my problem because i'm reading that you don't understand. I AM WRITING A DOS APPLICATION THAT READ THE BOOT SECTOR OF A HARD DISK AND BECAUSE OF THIS MY DOS APPLICATION DON'T WORKS.
THE PROBLEM IS NOT THAT CPU IS IN PROTECTED MODE BECAUSE THE DOS IS IN V86 MODE.
THE PROBLEM HAPPEN WHEN THE INT 13h FIND THE LES AX,SP INSTRUCTION AND DL IS 80h(HARD DISK). WHEN MY DOS APPLICATION GO TO THIS INSTRUCTION AT INT 13h AND AX = 0201h and DL = 80h THE NTVDM SHOW THE ERROR MESSAGE AND INT 13 RETURNS A ERROR(AH = 80h).
WHAT CAN I DO TO READ THE BOOT SECTOR OF A HARD DISK WITH AN APPLICATION THAT USE THE INT 13h AND WITHOUT CALL API AND WITHOUT USE VIRTUAL MACHINES???
Re: DOS application don't work
Posted: Fri Apr 13, 2012 10:13 am
by bluemoon
You are asking how to write DOS programs that uses BIOS call and not run in DOS, but in Windows, and you asking that on an OS development forum which we focus on develop our own OS.
Think again. Try application development forum like stackoverflow.
Hint: Windows provide DOS emulation, but that is not pure DOS, it may deny some access.
Re: DOS application don't work
Posted: Fri Apr 13, 2012 11:15 am
by Combuster
0x1f1 wrote:you don't understand. ALL CAPS WITH LOTS OF MARKUP
You obviously don't understand a thing about etiquette or reading forum rules.
You can't provide the functionality and meet all the other irrelevant requirements at the same time. End of story. Try not to post before you understand and accept that fact.
Re: DOS application don't work
Posted: Fri Apr 13, 2012 11:25 am
by xenos
Combuster wrote:0x1f1 wrote:you don't understand. ALL CAPS WITH LOTS OF MARKUP
You obviously don't understand a thing about etiquette or reading forum rules.
...or the relation between DOS, Windows, VM86, protected mode, real mode and BIOS calls.
Re: DOS application don't work
Posted: Fri Apr 13, 2012 12:55 pm
by DavidCooper
MAYBE SHOUTING EVEN LOUDER WOULD HELP?
Re: DOS application don't work
Posted: Fri Apr 13, 2012 3:42 pm
by 0x1f1
WHY YOU ARE INSULTING ME??? The only thing that I can't understand is that when my DOS Application that use INT 13h enter at INT 13h it find the instruction LES AX,SP that stop the application. What is the instrunction LES AX,SP and why this instruction stop the DOS application that I write?
Re: DOS application don't work
Posted: Fri Apr 13, 2012 4:01 pm
by linguofreak
0x1f1 wrote:THE PROBLEM IS NOT THAT CPU IS IN PROTECTED MODE BECAUSE THE DOS IS IN V86 MODE.
V86 mode is a subset of protected mode, and V86 mode programs can only do as much direct hardware access as the OS allows them to do, which, in modern versions of Windows, is pretty much nothing.
WHAT CAN I DO TO READ THE BOOT SECTOR OF A HARD DISK WITH AN APPLICATION THAT USE THE INT 13h AND WITHOUT CALL API AND WITHOUT USE VIRTUAL MACHINES???
Probably nothing. There's not a lot of back compatibility between modern Windows versions and DOS (and absolutely no back compatibility with DOS for 64-bit Windows, except via emulation or virtual machines).
Re: DOS application don't work
Posted: Fri Apr 13, 2012 4:04 pm
by linguofreak
Thomas wrote:Best way would be to run dos in an emulator like Virtual PC if you want to run the application as such
Considering that he seems to want to edit the boot sector of his machine's physical hard disk, I don't think an emulator or VM would help.
Re: DOS application don't work
Posted: Fri Apr 13, 2012 4:16 pm
by Thomas
linguofreak wrote:Thomas wrote:Best way would be to run dos in an emulator like Virtual PC if you want to run the application as such
Considering that he seems to want to edit the boot sector of his machine's physical hard disk, I don't think an emulator or VM would help.
Sorry for that, but using int13h is definitely not the way go ....
@0x1f1 : I was trying to help, I do apologize if I have "read" you incorrectly .
--Thomas