Thread: Opening Disk Partition

  1. #1
    Registered User cfrost's Avatar
    Join Date
    Apr 2004
    Posts
    119

    Post Opening Disk Partition

    Hello guys,
    I have sucessfully open physical disk by using the CreateFile function and passing it the "\\.\\\\PHYSICALDISK1", but this methods opens a whole disk. I want to open an ext2 partion, given me disk number and partition number how can I do that???
    Software is like sex it is good when it is free

  2. #2
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,273
    I thought you could open individual drive letters?

    Of course, if you haven't got an ext2 file system driver installed, then Windows will ignore it and the only way you'll get to it is by reading the MBR at the start of the drive and finding your own way there.

    Try ext2ifs.

  3. #3
    Registered User cfrost's Avatar
    Join Date
    Apr 2004
    Posts
    119
    Quote Originally Posted by SMurf
    I thought you could open individual drive letters?

    Of course, if you haven't got an ext2 file system driver installed, then Windows will ignore it and the only way you'll get to it is by reading the MBR at the start of the drive and finding your own way there.

    Try ext2ifs.
    Actually I could have done this, but i am developing a software for browsing ext2fs so I have to do this stuff my self, so any help for MBR guys?
    Software is like sex it is good when it is free

  4. #4
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    I think you can open a specific partition with the format \device\harddiskX\partitionX. A little more info in this post. Note: Partitions are 1 based. partition0 is the physical disk.

    Another possible option is to open the physical disk and then use IOCTL_DISK_GET_DRIVE_LAYOUT to find out where your target partition starts. Use at your own risk.
    Last edited by anonytmouse; 11-18-2005 at 09:49 PM.

  5. #5
    Registered User cfrost's Avatar
    Join Date
    Apr 2004
    Posts
    119
    Well IOCTL_DISK_GET_DRIVE_LAYOUT only provides funtionallity for winnt or above, I want to do it for win 98SE or above, in other words I should look for partition table in MBR? Am I right?
    Software is like sex it is good when it is free

  6. #6
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Well IOCTL_DISK_GET_DRIVE_LAYOUT only provides funtionallity for winnt or above, I want to do it for win 98SE or above, in other words I should look for partition table in MBR? Am I right?
    I didn't think using CreateFile "\\.\\\\PHYSICALDISK1" would work in Windows 9x either. Anyway, I think the answer to your question is probably yes but my knowledge is limited.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Disk Partition Stuff
    By CodeMonkey in forum Tech Board
    Replies: 15
    Last Post: 12-19-2008, 11:53 AM
  2. Partition Problem
    By anirban in forum Tech Board
    Replies: 1
    Last Post: 09-30-2007, 03:32 AM
  3. Formatting Output
    By Aakash Datt in forum C++ Programming
    Replies: 2
    Last Post: 05-16-2003, 08:20 PM
  4. hardware interaction in c
    By vineetwadwekar in forum C Programming
    Replies: 6
    Last Post: 03-29-2002, 09:01 AM
  5. partition disk without re-installing?
    By greenRoom in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 11-05-2001, 09:36 PM