AttachVirtualDisk
If you want to control the drive letter instead of letting windows to assign one, use ATTACH_VIRTUAL_DISK_FLAG_NO_DRIVE_LETTER and mount the volume manually.
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVP