DOS application don't work

Programming, for all ages and all languages.
0x1f1
Posts: 4
Joined: Fri Apr 13, 2012 2:07 am

DOS application don't work

Post 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?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: DOS application don't work

Post by Combuster »

Try actually running DOS instead of Windows.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re: DOS application don't work

Post 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.
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
User avatar
Yoda
Member
Member
Posts: 255
Joined: Tue Mar 09, 2010 8:57 am
Location: Moscow, Russia

Re: DOS application don't work

Post 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.
Yet Other Developer of Architecture.
OS Boot Tools.
Russian national OSDev forum.
0x1f1
Posts: 4
Joined: Fri Apr 13, 2012 2:07 am

Re: DOS application don't work

Post 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?
User avatar
Thomas
Member
Member
Posts: 281
Joined: Thu Jun 04, 2009 11:12 pm

Re: DOS application don't work

Post 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
0x1f1
Posts: 4
Joined: Fri Apr 13, 2012 2:07 am

Re: DOS application don't work

Post 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???
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: DOS application don't work

Post 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.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: DOS application don't work

Post 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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
xenos
Member
Member
Posts: 1118
Joined: Thu Aug 11, 2005 11:00 pm
Libera.chat IRC: xenos1984
Location: Tartu, Estonia
Contact:

Re: DOS application don't work

Post 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.
Programmers' Hardware Database // GitHub user: xenos1984; OS project: NOS
User avatar
DavidCooper
Member
Member
Posts: 1150
Joined: Wed Oct 27, 2010 4:53 pm
Location: Scotland

Re: DOS application don't work

Post by DavidCooper »

MAYBE SHOUTING EVEN LOUDER WOULD HELP?
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c

MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming
0x1f1
Posts: 4
Joined: Fri Apr 13, 2012 2:07 am

Re: DOS application don't work

Post 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?
linguofreak
Member
Member
Posts: 510
Joined: Wed Mar 09, 2011 3:55 am

Re: DOS application don't work

Post 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).
linguofreak
Member
Member
Posts: 510
Joined: Wed Mar 09, 2011 3:55 am

Re: DOS application don't work

Post 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.
User avatar
Thomas
Member
Member
Posts: 281
Joined: Thu Jun 04, 2009 11:12 pm

Re: DOS application don't work

Post 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
Locked