| Platform SDK: Files and I/O |
The following sample demonstrates how to unmount a volume mounted at a volume mount point using the DeleteVolumeMountPoint function.
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <stdio.h>
void
Syntax (char *argv)
{
printf("%s unmounts a volume from the volume mount point.\n", argv);
printf ("E.g. \"%s c:\\mnt\\fdrive\\\"\n", argv);
}
int
main(int argc, char *argv[])
{
BOOL bFlag;
if (argc != 2)
{
Syntax (argv[0]);
return (-1);
}
// We should do some error checking on the path argument, such as
// ensuring that there is a trailing backslash.
bFlag = DeleteVolumeMountPoint(
argv[1] // Path of the volume mount point
);
printf ("%s %s in unmounting the volume at %s.\n",
argv[0], bFlag ? "succeeded" : "failed", argv[1]);
return (bFlag);
}