static void test_GetVolumeNameForVolumeMountPointW(void) { BOOL ret; WCHAR volume[MAX_PATH], path[] = {'c',':','\\',0}; DWORD len = sizeof(volume) / sizeof(WCHAR); /* not present before w2k */ if (!pGetVolumeNameForVolumeMountPointW) { skip("GetVolumeNameForVolumeMountPointW not found\n"); return; } ret = pGetVolumeNameForVolumeMountPointW(path, volume, 0); ok(ret == FALSE, "GetVolumeNameForVolumeMountPointA succeeded\n"); ok(GetLastError() == ERROR_FILENAME_EXCED_RANGE || GetLastError() == ERROR_INVALID_PARAMETER, /* Vista */ "wrong error, last=%d\n", GetLastError()); if (0) { /* these crash on XP */ ret = pGetVolumeNameForVolumeMountPointW(path, NULL, len); ok(ret == FALSE, "GetVolumeNameForVolumeMountPointW succeeded\n"); ret = pGetVolumeNameForVolumeMountPointW(NULL, volume, len); ok(ret == FALSE, "GetVolumeNameForVolumeMountPointW succeeded\n"); } ret = pGetVolumeNameForVolumeMountPointW(path, volume, len); ok(ret == TRUE, "GetVolumeNameForVolumeMountPointW failed\n"); }
static void test_GetVolumeNameForVolumeMountPointW(void) { BOOL ret; WCHAR volume[MAX_PATH], path[] = {'c',':','\\',0}; DWORD len = sizeof(volume) / sizeof(WCHAR); /* not present before w2k */ if (!pGetVolumeNameForVolumeMountPointW) { skip("GetVolumeNameForVolumeMountPointW not found\n"); return; } ret = pGetVolumeNameForVolumeMountPointW(path, volume, 0); ok(ret == FALSE, "GetVolumeNameForVolumeMountPointA succeeded\n"); if (0) { /* these crash on XP */ ret = pGetVolumeNameForVolumeMountPointW(path, NULL, len); ok(ret == FALSE, "GetVolumeNameForVolumeMountPointW succeeded\n"); ret = pGetVolumeNameForVolumeMountPointW(NULL, volume, len); ok(ret == FALSE, "GetVolumeNameForVolumeMountPointW succeeded\n"); } ret = pGetVolumeNameForVolumeMountPointW(path, volume, len); ok(ret == TRUE, "GetVolumeNameForVolumeMountPointW failed\n"); }
static void test_GetVolumePathNamesForVolumeNameW(void) { static const WCHAR empty[] = {0}; static const WCHAR drive_c[] = {'c',':','\\',0}; static const WCHAR volume_null[] = {'\\','\\','?','\\','V','o','l','u','m','e', '{','0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0','0','0', '-','0','0','0','0','-','0','0','0','0','0','0','0','0','0','0','0','0','}','\\',0}; BOOL ret; WCHAR volume[MAX_PATH], buffer[MAX_PATH]; DWORD len, error; if (!pGetVolumePathNamesForVolumeNameW || !pGetVolumeNameForVolumeMountPointW) { win_skip("required functions not found\n"); return; } ret = pGetVolumeNameForVolumeMountPointW( drive_c, volume, sizeof(volume)/sizeof(volume[0]) ); ok(ret, "failed to get volume name %u\n", GetLastError()); SetLastError( 0xdeadbeef ); ret = pGetVolumePathNamesForVolumeNameW( empty, NULL, 0, NULL ); error = GetLastError(); ok(!ret, "expected failure\n"); ok(error == ERROR_INVALID_NAME, "expected ERROR_INVALID_NAME got %u\n", error); SetLastError( 0xdeadbeef ); ret = pGetVolumePathNamesForVolumeNameW( volume, NULL, 0, NULL ); error = GetLastError(); ok(!ret, "expected failure\n"); ok(error == ERROR_MORE_DATA, "expected ERROR_MORE_DATA got %u\n", error); SetLastError( 0xdeadbeef ); ret = pGetVolumePathNamesForVolumeNameW( volume, buffer, 0, NULL ); error = GetLastError(); ok(!ret, "expected failure\n"); ok(error == ERROR_MORE_DATA, "expected ERROR_MORE_DATA got %u\n", error); if (0) { /* crash */ ret = pGetVolumePathNamesForVolumeNameW( volume, NULL, sizeof(buffer), NULL ); ok(ret, "failed to get path names %u\n", GetLastError()); } ret = pGetVolumePathNamesForVolumeNameW( volume, buffer, sizeof(buffer), NULL ); ok(ret, "failed to get path names %u\n", GetLastError()); len = 0; memset( buffer, 0xff, sizeof(buffer) ); ret = pGetVolumePathNamesForVolumeNameW( volume, buffer, sizeof(buffer), &len ); ok(ret, "failed to get path names %u\n", GetLastError()); ok(len == 5, "expected 5 got %u\n", len); ok(!buffer[4], "expected double null-terminated buffer\n"); len = 0; volume[1] = '?'; volume[lstrlenW( volume ) - 1] = 0; SetLastError( 0xdeadbeef ); ret = pGetVolumePathNamesForVolumeNameW( volume, buffer, sizeof(buffer), &len ); error = GetLastError(); ok(!ret, "expected failure\n"); ok(error == ERROR_INVALID_NAME, "expected ERROR_INVALID_NAME got %u\n", error); len = 0; volume[0] = '\\'; volume[1] = 0; SetLastError( 0xdeadbeef ); ret = pGetVolumePathNamesForVolumeNameW( volume, buffer, sizeof(buffer), &len ); error = GetLastError(); ok(!ret, "expected failure\n"); todo_wine ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got %u\n", error); len = 0; lstrcpyW( volume, volume_null ); SetLastError( 0xdeadbeef ); ret = pGetVolumePathNamesForVolumeNameW( volume, buffer, sizeof(buffer), &len ); error = GetLastError(); ok(!ret, "expected failure\n"); ok(error == ERROR_FILE_NOT_FOUND, "expected ERROR_FILE_NOT_FOUND got %u\n", error); }