UnmountMedia Method
Unmounts media from the virtual drive.
Syntax
int UnmountMedia(bool bForceUnmount);
Remarks
This method unmounts the virtual storage media from the virtual drive. The virtual drive itself, as well as any existing mounting points, remain present.
If ForceUnmount is true, all open files are forcefully closed. If ForceUnmount is false and open files or directories are detected, this method fails with an error.
This method must not be called for plug-and-play virtual drives with non-removable media (see StorageType); attempting to do so will cause the call will fail with an "access denied" error.
Note: This method can only be called after creating a virtual drive, and cannot be called within events.
Error Handling
This method returns a result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message. (Note: This method's result code can also be obtained by calling the GetLastErrorCode() method after it returns.)