CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 13 of 13
  1. #1
    Join Date
    Sep 2010
    Posts
    12

    Unhappy INT 13h in Windows

    Hello all, this is my first post. Well its silly to ask as it may be the fact that u can't use INT 13h under windows (sorry for being silly). well i intend to read write sectors of ntfs formatted hard-drive (total size 320 GB volume size 70 GB) in pure assembly (plz don't suggest anything about winapi in MASM). well here is what i gave as a first try, and after googling here and thre resort to asking. plz help. Is there any way to make 13h work under windows ?? Or any other way than int 13h, 25h.(Tried both gave me a message of a program is attempting to access hardisk directly, this may be due to a ... blah blah)
    Code:
    .model small
    .stack 100h
    .data
    	buffer db 2048 dup(?)
    	err_msg db "error occured$"
    .code
    start:
    	mov ax, @data
    	mov ds, ax
    	mov es, ax
    
    	mov ah, 02h
    	mov al, 01h
    	mov bx, offset buffer
    	mov cx, 1
    	mov dx, 80h
    	int 13h
    
    	mov ah, 4ch
    	int 21h
    end start
    Thanx in advance. Regards. And sorry for being stupid.

  2. #2
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: INT 13h in Windows

    Under Windows NT there is no way to get direct disk access to work other than writing a driver.

    If you want to play around with this you have to use DOS. I don't remember how things were in Win95 but I guess that even though most stuff was allowed, direct disk access was probably denied.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  3. #3
    Join Date
    Sep 2010
    Posts
    12

    Re: INT 13h in Windows

    Quote Originally Posted by S_M_A View Post
    Under Windows NT there is no way to get direct disk access to work other than writing a driver.

    If you want to play around with this you have to use DOS. I don't remember how things were in Win95 but I guess that even though most stuff was allowed, direct disk access was probably denied.
    Well sir then could u provide me some link about developing VxD, but plz try to avoid winapi and winddk as much as possible).

  4. #4
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: INT 13h in Windows

    Quote Originally Posted by dumb_terminal View Post
    Well sir then could u provide me some link about developing VxD, but plz try to avoid winapi and winddk as much as possible).
    Huh... how could you even think about writing a driver without using the ddk? If I were you I'd either forget about this or explain what you want to achieve, someone might have a better approach.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  5. #5
    Join Date
    Sep 2010
    Posts
    12

    Question Re: INT 13h in Windows

    Well i was trying to read the boot sector of c drive, and if succeeded i would have moved forward to write the 0 sector of an usb stick, which would launch a program to read the FAT of each drive and if i were successful i wud have tried to show the files. thats all. Well i really need to do this manually because i am keen to learn sir. Thats all. Regards.

  6. #6
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: INT 13h in Windows

    Well, do it the normal way instead. You don't have to read the boot sector to display the files.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  7. #7
    Join Date
    Sep 2010
    Posts
    12

    Re: INT 13h in Windows

    Sorry to bother u again, Sir do u mean i get the INT 21 services to get file names during boot time ?? I Thought i even need a bios 10h service even to write hello world. Then again i need some way to write the 0 sector of USB (without the linux dd command -- yeah i have written a boot time hello world then just restart). Well sorry to disturb u sir. But at least u tried to help.
    Last edited by dumb_terminal; September 11th, 2010 at 03:33 PM.

  8. #8
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: INT 13h in Windows

    Int 21 is a DOS service and int 10 BIOS service so both are available in a system booting DOS. As in previous post, what are you trying to accomplish?
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  9. #9
    Join Date
    Sep 2010
    Posts
    12

    Post Re: INT 13h in Windows

    Quote Originally Posted by S_M_A View Post
    Int 21 is a DOS service and int 10 BIOS service so both are available in a system booting DOS. As in previous post, what are you trying to accomplish?
    Sir i am a student, and just experimenting with things. My teacher said, before dos botstrap is called (which i prevented by placing my code to 7C00 ) none of the dos service is available, and i am just trying to use int 13h for testing purpose as i can't debug during boottime do i (if somehing goes wrong)?? as for my main purpose i have said, to write to sector 0 of usb manually (ms debug is not letting me and can't find any alternative way, and i won't use linux DD if i mustn't), the code inside it will prevent the dos bootup, instead bring out a terminal of my own.
    Thank u for hearing sir.
    Regards.

  10. #10
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: INT 13h in Windows

    All I can think of is to install DOS (or your own OS) in a virtual machine and play around with it. Before the OS boots you have all access to int13.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  11. #11
    Join Date
    Sep 2010
    Posts
    12

    Resolved Re: INT 13h in Windows

    Quote Originally Posted by S_M_A View Post
    All I can think of is to install DOS (or your own OS) in a virtual machine and play around with it. Before the OS boots you have all access to int13.
    Thank u for ur excellent idea sir, yeah VM that completely got out of my mind, but where to download dos and run it in VM ?? anyway i'll google my way through. Thank u for all ur help sir. Next time i encounter a problem i'll know where to seek guidence, u r being patient sir. that will encourage newbies like me to post more and more. Regards.

  12. #12
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: INT 13h in Windows

    I searched MS home but didn't find any public DOS download page. I found some other locations but of course I can neither guarantee the legality nor that the download is free of virus. Anyway here's one http://www.brothersoft.com/ms-dos-download-226177.html

    Another way could be to create a DOS boot diskette in XP, create a VM and boot it using the diskette and then transfer the system onto the virtual drive (sys c:, copy rest of the files)

    Another thing that I suddenly realised that I had forgot is that you have to get yourself an assembler that is capable of creating 16-bit programs. I guess that's not a problem judging from your code but I think I should mention it if other people stumble upon this thread.

    EDIT: This might be a good solution to the download issue http://www.drdos.net/download.htm or maybe post #7 here http://www.neowin.net/forum/topic/32...ad-ms-dos-622/
    Last edited by S_M_A; September 12th, 2010 at 03:18 PM.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  13. #13
    Join Date
    Sep 2010
    Posts
    12

    Re: INT 13h in Windows

    Thank u again Sir, u have been really helpful.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured