Closed Thread
Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 46

Thread: How to get floppy disk information ?!!

  1. #21
    dinklebaga is offline Newbie
    Join Date
    Mar 2009
    Posts
    23
    Rep Power
    0

    Re: How to get floppy disk information ?!!

    Yes

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #22
    Join Date
    Oct 2007
    Location
    /dev/null
    Posts
    4,513
    Blog Entries
    8
    Rep Power
    59

    Re: How to get floppy disk information ?!!

    Try using typecasts to unsigned int when passing in the arguments.

    Code:
    printf("blah... %02X %02X %02X\n", (unsigned int)_boot.jumpCode[0] ...);

  4. #23
    dinklebaga is offline Newbie
    Join Date
    Mar 2009
    Posts
    23
    Rep Power
    0

    Re: How to get floppy disk information ?!!

    still not working... is there anywhere I can get a free version of the Borland C Compiler? Either that or relatively cheaply?

  5. #24
    Join Date
    Oct 2007
    Location
    /dev/null
    Posts
    4,513
    Blog Entries
    8
    Rep Power
    59

    Re: How to get floppy disk information ?!!

    No idea, try Google. I use Microsoft Visual C++ 2008 Express Edition. (Also free, great for students like me.)

  6. #25
    dinklebaga is offline Newbie
    Join Date
    Mar 2009
    Posts
    23
    Rep Power
    0

    Re: How to get floppy disk information ?!!

    Is Visual Studio compatible with 16bit DOS environments? I only ask because you can see I am doing low level operations that will in the end take me on to HD's which cannot be directly accessed in the Windows environments (XP or Vista)

  7. #26
    Join Date
    Oct 2007
    Location
    /dev/null
    Posts
    4,513
    Blog Entries
    8
    Rep Power
    59

    Re: How to get floppy disk information ?!!

    It depends on what you mean by "cannot be directly accessed". There are ways of getting around certain blocks without resorting to 16-bit stuff, unless you're talking about ancient hard drives from the 80s or something.

  8. #27
    dinklebaga is offline Newbie
    Join Date
    Mar 2009
    Posts
    23
    Rep Power
    0

    Re: How to get floppy disk information ?!!

    You've seen the ASM code i have used, by switching the drive (DL) to 0x80 (The main hard drive in the PC) you get an automatic warning from windows saying "An application has tried to directly access the hard drive, which cannot be supported"

  9. #28
    Join Date
    Oct 2007
    Location
    /dev/null
    Posts
    4,513
    Blog Entries
    8
    Rep Power
    59

    Re: How to get floppy disk information ?!!

    This won't work on hard drives, since they most likely use NTFS (older ones might use FAT32), and those have different boot sector layouts. And how exactly did you try accessing the hard drive beforehand? ReadFile worked for me.

    Code:
    #include <windows.h>
    
    /*stuff here....*/
    
    #pragma pack(push,1)
    typedef struct
    {
     /*definition here*/
    }BS;
    #pragma pack(pop)
    
    BS mbr;
    DWORD dwBytesRead = 0;
    HANDLE hDrive = CreateFile(
    	   		"\\\\.\\C:", /*file path*/
    			GENERIC_READ, /*requested access*/
    			FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, /*sharing*/,
    			NULL, /*use default security descriptor*/,
    			OPEN_EXISTING, /*don't create*/
    			0, /*attributes - don't change any*/
    			NULL /*file to use as template. ignore this.*/
    			);
    							
    if(!ReadFile(hDrive,&mbr,sizeof(BS),&dwBytesRead,NULL))
    {
    	/*handle errors here*/
    }
    
    /*close handle when done*/
    CloseHandle(hDrive);
    Last edited by dargueta; 03-09-2009 at 01:30 PM. Reason: Fixed errors

  10. #29
    dinklebaga is offline Newbie
    Join Date
    Mar 2009
    Posts
    23
    Rep Power
    0

    Re: How to get floppy disk information ?!!

    Basically i'm writing a program that can access the hard drive directly and write data into the slack space but i need to obtain the disk geometry from the boot sector first. At the moment i'm working on obtaining the data from the boot sector on a FAT disk but i have the relevant information for doing this with an NTFS disk as well.

  11. #30
    Join Date
    Oct 2007
    Location
    /dev/null
    Posts
    4,513
    Blog Entries
    8
    Rep Power
    59

    Re: How to get floppy disk information ?!!

    This sounds suspiciously like a boot sector virus. Try my suggestion above.

Closed Thread
Page 3 of 5 FirstFirst 12345 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Loose disk??
    By bbqroast in forum Technology Ramble
    Replies: 3
    Last Post: 10-16-2010, 11:37 PM
  2. Disk Failure
    By lor in forum The Lounge
    Replies: 15
    Last Post: 10-08-2010, 03:24 AM
  3. Floppy DUO | Metallica - Fade To Back
    By Turk4n in forum The Lounge
    Replies: 10
    Last Post: 05-04-2009, 04:19 PM
  4. Compilers that fit on floppy?
    By jayrare in forum General Programming
    Replies: 24
    Last Post: 07-03-2008, 07:37 AM

Tags for this Thread

Bookmarks

Posting Permissions

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