Skip to content

Instantly share code, notes, and snippets.

@rossy
Created February 17, 2014 04:40
Show Gist options
  • Save rossy/9044827 to your computer and use it in GitHub Desktop.
Save rossy/9044827 to your computer and use it in GitHub Desktop.
#include <windows.h>
#include <stdio.h>
#include <stdbool.h>
static bool is_network_path(const wchar_t *path)
{
wchar_t vol[32768];
if (GetVolumePathNameW(path, vol, sizeof(vol) / sizeof(wchar_t)))
return GetDriveTypeW(vol) == DRIVE_REMOTE;
return false;
}
int wmain(int argc, wchar_t **argv)
{
wprintf(L"is_network_path() = %ls\n",
is_network_path(argv[1]) ? L"true" : L"false");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment