A purely out-of-curiosity question about @DriveType and @DriveTypeEx

I had a reason to use @DriveType (and this question also applies to @DriveTypeEx), and I noticed that the drive type for my Z: drive is given as "3" ("fixed disk"), where, as I have often mentioned before in this forum, my Z: drive really is a RAM disk. So how is a drive that is recognized as a RAM disk by @DriveType actually created?

- Dan

Charles Dye

Super Moderator
Staff member
May 20, 2008
Albuquerque, NM
It's probably just calling down to the Windows GetDriveType() function. I have no idea how that works internally, but....

A typical RAMdisk emulates a hard drive, which makes them hard to distinguish. Back in DOS days, one method of differentiating between them was to count the file allocation tables: a "hard drive" with only one FAT was probably a RAMdrive. Have you perhaps reformatted your RAMdrive? Made it NTFS? That would bollix my simpleminded test for sure.
Charles, I kind of suspect the same as well (I didn't bother to take the time to actually look for a Windows "GetDriveType()" API function but I really thought that such a thing probably existed and apparently I was right; and Rex's code seems to be more reliable than the native Windows code, anyway! :)); and yes, it is formatted as NTFS.