-
April 24th, 2020, 11:42 AM
#1
[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: https://docs.microsoft.com/en-us/win...em-recognition But I don't know how to fill this structure: FILE_SYSTEM_RECOGNITION_STRUCTURE. Is there another way to achieve this information ?
-
April 24th, 2020, 04:08 PM
#2
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?
typedef struct _FILE_SYSTEM_RECOGNITION_STRUCTURE {
UCHAR Jmp[3];
UCHAR FsName[8];
UCHAR MustBeZero[5];
ULONG Identifier;
USHORT Length;
USHORT Checksum;
} FILE_SYSTEM_RECOGNITION_STRUCTURE;
Victor Nijegorodov
-
April 24th, 2020, 04:23 PM
#3
Re: Find device partition type
Use WMI, it gives drive info plus a whole lot more.
-
April 25th, 2020, 04:50 AM
#4
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.
https://docs.microsoft.com/en-us/win...meinformationa
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 https://creativecommons.org/publicdomain/zero/1.0/ 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++23 Compiler: Microsoft VS2022 (17.6.5)
-
April 26th, 2020, 02:07 AM
#5
Re: Find device partition type
All solution proposed by you are working well ! I've used the simplest one: https://docs.microsoft.com/en-us/win...meinformationa
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|