Whew, 20 minutes of panic! My floppy drive is back. Hopefully it won't dissapear at the next reboot. The code to fix something is always a lot more complex than the code to break it.
Code:
int main() {
BOOL bFlag;
char szUniqueVolumeName[MAX_PATH];
bFlag = DefineDosDevice (DDD_RAW_TARGET_PATH, "A:",
"\\device\\floppy0");
if (!bFlag) printf("definedosdevice failed: %d\n", GetLastError());
if (!GetVolumeNameForVolumeMountPoint ("A:\\",
szUniqueVolumeName,
MAX_PATH)) {
printf("Failed to get volume name: %d", GetLastError());
}
bFlag = DefineDosDevice (
DDD_RAW_TARGET_PATH|DDD_REMOVE_DEFINITION|
DDD_EXACT_MATCH_ON_REMOVE, "A:",
"\\device\\floppy0");
if (!bFlag) printf("definedosdevice remove failed: %d", GetLastError());
bFlag = SetVolumeMountPoint ("A:\\", szUniqueVolumeName);
printf("Result: %d, %d", bFlag, GetLastError());
getchar();
return 0;
}