Search code examples
c++windowsmountdisk-partitioningfat32

Mounting a hidden partition in windows using C# or C++ program


I have a FAT32 partition that is hidden. I like to copy files to it from a Windows application implemented in C# or C++.

The examples I have seen end up creating a drive in Explorer while the hidden partition is mounted.

Is there a way to mount this partition programmatically without it being visible in Windows Explorer? Then I like to copy files to it and unmount it.

Thanks for your help!


Solution

  • CreateSymbolicLink did the trick. You can pass path of a volume to it. It lets you create a symbolic link to hidden partitions. You can create sym links to specific files as well as directories with it. The path of hidden partition should be passed like "\?\GLOBALROOT\device\harddisk0\partition1\dirA\dirB".