Hard disk partition info

Hi all...

I am trying to write a windows program that will access file systems not supported by windows (eg linux ext3).
I need to know how to get the hard disk partitions info (size, location, ...) and i also need a function that can read sectors from the hard disk (raw SECTORS, not FILES) under WINNT.

Note: This is a WINDOWS application. I can't use 'absread' which is a DOS function.

Can you guys help me?

Thanks.

Comments

  • : Hi all...
    :
    : I am trying to write a windows program that will access file systems not supported by windows (eg linux ext3).
    : I need to know how to get the hard disk partitions info (size, location, ...) and i also need a function that can read sectors from the hard disk (raw SECTORS, not FILES) under WINNT.
    :
    : Note: This is a WINDOWS application. I can't use 'absread' which is a DOS function.
    :
    : Can you guys help me?
    :
    : Thanks.
    :
    This is easier in dos...

    You'll need to make a driver or something that has high enough previliges to access the bios interupts.

    Since you maybe want to use it as a device, like D:, a driver should be what you want.
  • : : Hi all...
    : :
    : : I am trying to write a windows program that will access file systems not supported by windows (eg linux ext3).
    : : I need to know how to get the hard disk partitions info (size, location, ...) and i also need a function that can read sectors from the hard disk (raw SECTORS, not FILES) under WINNT.
    : :
    : : Note: This is a WINDOWS application. I can't use 'absread' which is a DOS function.
    : :
    : : Can you guys help me?
    : :
    : : Thanks.
    : :
    : This is easier in dos...
    :
    : You'll need to make a driver or something that has high enough previliges to access the bios interupts.
    :
    : Since you maybe want to use it as a device, like D:, a driver should be what you want.
    :

    Try looking at the Explore2fs source code:
    http://www.chrysocome.net/explore2fs

    The DiskIO 2 program is a 16-bit DLL, that has the low-level code needed to do this. It uses DPMI(DOS Protected Mode Interface) to call real mode interrupts(int 13h mainly) from protected mode. With DPMI you don`t need to make a driver. Calling 16-bit DLLs is different from 32-bit ones, so check the Explore2fs code to understand how to call them.

    This is much easier to do in DOS, as IDK said, because in DOS, you can call interrupt 13h directly.
  • : : : Hi all...
    : : :
    : : : I am trying to write a windows program that will access file systems not supported by windows (eg linux ext3).
    : : : I need to know how to get the hard disk partitions info (size, location, ...) and i also need a function that can read sectors from the hard disk (raw SECTORS, not FILES) under WINNT.
    : : :
    : : : Note: This is a WINDOWS application. I can't use 'absread' which is a DOS function.
    : : :
    : : : Can you guys help me?
    : : :
    : : : Thanks.
    : : :
    : : This is easier in dos...
    : :
    : : You'll need to make a driver or something that has high enough previliges to access the bios interupts.
    : :
    : : Since you maybe want to use it as a device, like D:, a driver should be what you want.
    : :
    :
    : Try looking at the Explore2fs source code:
    : http://www.chrysocome.net/explore2fs
    :
    : The DiskIO 2 program is a 16-bit DLL, that has the low-level code needed to do this. It uses DPMI(DOS Protected Mode Interface) to call real mode interrupts(int 13h mainly) from protected mode. With DPMI you don`t need to make a driver. Calling 16-bit DLLs is different from 32-bit ones, so check the Explore2fs code to understand how to call them.
    :
    : This is much easier to do in DOS, as IDK said, because in DOS, you can call interrupt 13h directly.
    :

    That is great... But I am quite sure that this can be done under windows, and I know a couple of programs that do. PartitionMagic, for example, can not only access the hard disk, but can also modify and resize hard disk partitions. There's got to be some way!
  • : : Try looking at the Explore2fs source code:
    : : http://www.chrysocome.net/explore2fs
    : :
    : : The DiskIO 2 program is a 16-bit DLL, that has the low-level code needed to do this. It uses DPMI(DOS Protected Mode Interface) to call real mode interrupts(int 13h mainly) from protected mode. With DPMI you don`t need to make a driver. Calling 16-bit DLLs is different from 32-bit ones, so check the Explore2fs code to understand how to call them.
    : :
    : : This is much easier to do in DOS, as IDK said, because in DOS, you can call interrupt 13h directly.
    : :
    :
    : That is great... But I am quite sure that this can be done under windows, and I know a couple of programs that do. PartitionMagic, for example, can not only access the hard disk, but can also modify and resize hard disk partitions. There's got to be some way!
    :

    This IS a Windows solution. You must be confused because of the 16-bit stuff and DPMI. Although it might be hard to imagine, in Windows there are lot of things, that can be done easier and even exclusively in 16-bit code. In fact, one of the first things, that Windows loads during startup is the DOS Protected Mode Interface(DPMI).

    32-bit programs, that use other 16-bit code(like Explore2fs does), need a 16-bit DLL, which handles calls between the program and the 16-bit code in the Windows kernel. That DLL is called the "thunking layer", because that`s what thunking is, interfacing between 2 modules. The DiskIO 2 program is the DLL that does this. Yep, it`s hard to grasp, but noone says it`s easy.

    Take a look at the Explore2fs program and you`ll see, that it`s a Windows program.
  • In fact, one of the first things, that Windows loads during startup is the DOS Protected Mode Interface(DPMI).
    :

    depends on the version of MS-Windows. Starting with Windows 4.0 it did not do that, the os does not contain any 16-bit code at all, nor is there any longer any trace of MS-DOS os. MS-Windows is now an operating system all of its own and does not rely on any 16-bit code. The hardware boots directly into MS-Windows.

    http://www.google.com/search?hl=en&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=windows+xp+architecture&spell=1


  • In WinNT based systems, one can do it with WinAPI, provided administrator priviledges. Im a bit uneasy posting this, because I don`t have the opportunity to test this on NT and it didn`t seem to work for Win98se, probably because it needs the 16-bit code, which works fine.

    [code]//Open a physical drive
    [blue]hPhDrive = CreateFile([green]"\\.\PhysicalDriveX"[/green],
    GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
    OPEN_EXISTING, 0, 0);[/blue]
    [green]//Where X is the number of the physical drive(0 - C:, 1 - D: ...)[/green]

    //Now you can use the same functions for physical disk access as for file access.
    [blue]SetFilePointer(hPhDrive, 0, 0, FILE_BEGIN);[/blue]

    [blue]ReadFile(hPhDrive, lpBuffer, sizeof(buffer), &dwNumRead, 0);

    ...[/blue][/code]If this has to work on all Windows versions, then you`ll have to implement both this solution and the one I mentioned earlier. It`s all there in the Explore2fs source code.

    And stober, you`re right, thanks for the clarification!
  • :
    Hi all...
    :
    : I am trying to write a windows program that will access file systems
    : not supported by windows (eg linux ext3).
    : I need to know how to get the hard disk partitions info (size,
    : location, ...) and i also need a function that can read sectors from
    : the hard disk (raw SECTORS, not FILES) under WINNT.
    :
    : Note: This is a WINDOWS application. I can't use 'absread' which is
    : a DOS function.
    :
    : Can you guys help me?
    :
    : Thanks.
    :

    Hello bro.
    Me developing the same type of application. Did u find any good idea how to develop this application.
    Me searching from long time but still didn't found any good solution.

    Actually first i need to develop a prog. which only displays the existing partition on your drive. This much only but still can't do this too
This discussion has been closed.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories