I have a list of possible paths to use for a default input data directory (X:\Data; Y:\Data; Z:\Data). All of the possible paths are mapped network drives. I can check this using GetDriveType(pathStr) == DRIVE_REMOTE
. To determine the best one, I have narrowed down the list by selecting only paths that exist. Sometimes there will be more than one path left in the list, so to determine the best one at that point, I want to find the IP address of the server that the drive is mapped to, so I can compare it to my own IP address. For instance, if I have X:\
mapped to \\RemoteComputer\ShareName
, how can I find out from the string X:\Data
either the name or IP address of RemoteComputer
? (I already have the ability to find the IP address from a computer name).
views:
91answers:
2Thanks! That's just what I needed. For anyone else finding this answer, the only problem I had was that it only accepts paths with backslashes (no forward slashes), and the error message was 87 (look up in the error codes to find: ERROR_INVALID_PARAMETER). It doesn't tell you which parameter is invalid, and it doesn't say what was wrong with the parameter, but changing to backslashes fixed it.
Ben
2010-08-20 17:07:13
A:
Keep in mind, that not all (but the vast majority) of UNC paths start with a computer name. Some like WebDav, are a FQDN - others like TS remoting (i.e. \tsclient\c) aren't a machine at all, just a token that RDBSS recognizes.
Paul Betts
2010-08-20 23:31:29