From: Quinn Rafferty ramleejo@yahoo.com
The part one of the test gets the letter and path of a fixed drive. It then uses the path to get the drive. The test then verifies it is the same drive from before by comparing drive letters.
Wine-bug https://bugs.winehq.org/show_bug.cgi?id=57539 --- dlls/scrrun/tests/filesystem.c | 65 +++++++++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-)
diff --git a/dlls/scrrun/tests/filesystem.c b/dlls/scrrun/tests/filesystem.c index e53bd092ce9..fc959fbdafd 100644 --- a/dlls/scrrun/tests/filesystem.c +++ b/dlls/scrrun/tests/filesystem.c @@ -2729,6 +2729,68 @@ static void test_DoOpenPipeStream(void) ITextStream_Release(stream_write); }
+static void test_DriveGetPath(void) +{ + HRESULT hr; + IDrive *drive; + BSTR path, drive_letter; + + drive = get_fixed_drive(); + if (!drive) { + skip("No fixed drive found, skipping test.\n"); + return; + } + /*Gets the letter of the drive for comparison later*/ + drive_letter = NULL; + hr = IDrive_get_DriveLetter(drive, &drive_letter); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + + hr = IDrive_get_Path(drive, NULL); + ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr); + + + /*Get the path*/ + path = NULL; + hr = IDrive_get_Path(drive, &path); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(path != NULL, "got %p\n", path); + + + IDrive_Release(drive); + + /*If the path can be used to get the drive, it works.*/ + if(path != NULL && drive_letter != NULL){ + IDrive *drive_result; + BSTR result; + + hr = IFileSystem3_GetDrive(fs3, path, &drive_result); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + /*Get the letter of the returned drive*/ + if(SUCCEEDED(hr)){ + result = NULL; + hr = IDrive_get_DriveLetter(drive, &result); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(result != NULL, "got %p\n", result); + } + + if (SUCCEEDED(hr) && result != NULL) { + /*The path was successfuly returned*/ + ok(!lstrcmpW(drive_letter, result), "got %s, expected %s for drive spec %s\n", + wine_dbgstr_w(result), + wine_dbgstr_w(drive_letter), + wine_dbgstr_w(path)); + + SysFreeString(result); + } + + IDrive_Release(drive_result); + } + + SysFreeString(path); + SysFreeString(drive_letter); +} START_TEST(filesystem) { HRESULT hr; @@ -2773,7 +2835,8 @@ START_TEST(filesystem) test_GetSpecialFolder(); test_MoveFile(); test_DoOpenPipeStream(); - + test_DriveGetPath(); + IFileSystem3_Release(fs3);
CoUninitialize();