Determine if Drive is a local drive

I have a service application that can not use a mapped drive for working directory.
I want to add code to my setup program that will detect if the user has selected a path that is not on a local drive.

How can I detect if a drive is local or if it's a mapped drive?
LVL 30
AxterAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mikal613Commented:
0
RichieHindleCommented:
You need to use the GetDriveType API, which tells you whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or network drive.

UINT GetDriveType(LPCTSTR lpRootPathName);

lpRootPathName: Pointer to a null-terminated string that specifies the root directory of the disk to return information about. A trailing backslash is required. If this parameter is NULL, the function uses the root of the current directory.
Return Values: The return value specifies the type of drive. It can be one of the following values.

DRIVE_UNKNOWN: The drive type cannot be determined.
DRIVE_NO_ROOT_DIR: The root path is invalid. For example, no volume is mounted at the path.
DRIVE_REMOVABLE: The disk can be removed from the drive.
DRIVE_FIXED: The disk cannot be removed from the drive.
DRIVE_REMOTE: The drive is a remote (network) drive.
DRIVE_CDROM: The drive is a CD-ROM drive.
DRIVE_RAMDISK: The drive is a RAM disk.

The API is documented at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/getdrivetype.asp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AxterAuthor Commented:
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.