0

Let's say I have an SD card with about 10 partitions on it, some of them ext4 and some of them FAT32. Windows (10) only shows and mounts the first FAT32 partition on the card in the file explorer. If I want to write a tool in C/C++ that mounts the other FAT32 partitions on the card:

  1. can I do this from user space without needing a special kernel driver?
  2. what windows API would I use for this and specifically what are the relevant functions I should look at, which let me access the drive as a raw device, and which lets me query the drive for partitions and mount them?
zx485
  • 28,498
  • 28
  • 50
  • 59
b20000
  • 995
  • 1
  • 12
  • 30
  • 1
    You can use `DeviceIoControl` (https://blogs.msdn.microsoft.com/adioltean/2005/05/04/how-to-query-the-list-of-diskspartitions-for-a-certain-volume-and-viceversa/) or **WMI** windows managed instrumentation (https://msdn.microsoft.com/en-us/library/aa394515(v=vs.85).aspx). Some samples are available. For pure C access you must take care of COM interfaces for WMI. Anyway using the MS non standard C compiler it will work with not so much efforts. – Frankie_C Jun 03 '18 at 20:00
  • 1
    windows mount partition auto, when you open it by name. you can create temporary mount by `DefineDosDevice` or permanent by `IOCTL_MOUNTMGR_CREATE_POINT` – RbMm Jun 03 '18 at 20:26
  • Still the best way would be to write some KMD with Ntddk and have greater control over the resource management, instead of relying on the slow high level APIs – Edenia Jun 03 '18 at 20:42
  • (but you will have to use IRQLs to avoid race conditions shortly speaking) – Edenia Jun 03 '18 at 20:51
  • 1
    @Edenia - kernel mode here nothing give. *IRQLs* ?! – RbMm Jun 03 '18 at 20:53
  • @RbMm the interrupt request level – Edenia Jun 03 '18 at 20:56
  • @Edenia - no, i good know what is `IRQL` - i dont understand how you want use IRQL for this task and avoid race conditions – RbMm Jun 03 '18 at 21:05
  • no any IRQL here need at all – RbMm Jun 03 '18 at 21:06

0 Answers0