CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 5 of 5

Thread: [RESOLVED] Find device partition type

  1. #1
    Join Date
    Jan 2009

    [RESOLVED] Find device partition type

    Is there any way to know what type is a HDD device ? I need to test if a HDD partition has a specific type: NTFS, or FAT32 or EXFAT.

    From my researches I read that there is a structure that can be filled with this information: FILE_SYSTEM_RECOGNITION_STRUCTURE, taken from here: But I don't know how to fill this structure: FILE_SYSTEM_RECOGNITION_STRUCTURE. Is there another way to achieve this information ?

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Hanover Germany

    Re: Find device partition type

    And where did you read that this struct contains any value that points to the type of a HDD device?
    UCHAR Jmp[3];
    UCHAR FsName[8];
    UCHAR MustBeZero[5];
    ULONG Identifier;
    USHORT Length;
    USHORT Checksum;
    Victor Nijegorodov

  3. #3
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004

    Re: Find device partition type

    Use WMI, it gives drive info plus a whole lot more.

  4. #4
    2kaud's Avatar
    2kaud is online now Super Moderator Power Poster
    Join Date
    Dec 2012

    Re: Find device partition type

    Given the root directory name for the required device, use GetVolumeInformation(). The name of the type of format is returned via lpFileSystemNameBuffer.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++17 Compiler: Microsoft VS2019 (16.6.1)

  5. #5
    Join Date
    Jan 2009

    Re: Find device partition type

    All solution proposed by you are working well ! I've used the simplest one:

    Thank you all !

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)