PR 16592: dlls/kernel32/volume.c
G. Paul Ziemba
p-wine-bugs at ziemba.us
Tue Jan 6 12:25:01 CST 2009
Fix for PR 16592, GetVolumeInformationW() handling of unusual "root"
parameter.
--- dlls/kernel32/volume.c.orig 2008-12-05 08:57:45.000000000 -0800
+++ dlls/kernel32/volume.c 2008-12-22 00:15:51.000000000 -0800
@@ -518,7 +518,7 @@
HANDLE handle;
enum fs_type type = FS_UNKNOWN;
- if (!root)
+ if (!root || (root && root[0] == '\\' && root[1] == ':'))
{
WCHAR path[MAX_PATH];
GetCurrentDirectoryW( MAX_PATH, path );
--- dlls/kernel32/tests/volume.c.orig 2008-12-05 08:57:45.000000000 -0800
+++ dlls/kernel32/tests/volume.c 2009-01-06 09:52:19.000000000 -0800
@@ -29,6 +29,9 @@
static BOOL (WINAPI *pFindVolumeClose)(HANDLE);
static UINT (WINAPI *pGetLogicalDriveStringsA)(UINT,LPSTR);
static UINT (WINAPI *pGetLogicalDriveStringsW)(UINT,LPWSTR);
+static BOOL (WINAPI *pGetVolumeInformationW)(LPCWSTR,LPWSTR,DWORD,
+ DWORD*,DWORD*,DWORD*,LPWSTR,DWORD);
+static BOOL (WINAPI *pSetCurrentDirectoryA)(LPCSTR);
/* ############################### */
@@ -216,6 +219,48 @@
HeapFree(GetProcessHeap(), 0, buf);
}
+static void test_GetVolumeInformationW(void)
+{
+ //
+ // Check handling of root == "\\:"
+ // http://bugs.winehq.org/show_bug.cgi?id=16592
+ //
+
+ BOOL rc;
+ WCHAR root[] = {'\\',':',0};
+
+ if (!pGetVolumeInformationW) {
+ win_skip("GetVolumeInformationW not available\n");
+ return;
+ }
+
+ if (!pSetCurrentDirectoryA) {
+ win_skip("SetCurrentDirectoryA not available\n");
+ return;
+ }
+
+ //
+ // set current directory because GetVolumeInformationW refers
+ // to it in this test case
+ //
+ rc = pSetCurrentDirectoryA("C:\\");
+
+ ok(rc, "SetCurrentDirectoryA(\"C:\\\\\") failed\n");
+
+ rc = pGetVolumeInformationW(
+ root, // Root
+ NULL, // pLabel
+ 0, // LabelLen
+ NULL, // pSerial
+ NULL, // pFilenameLen
+ NULL, // pFlags
+ NULL, // pFsname
+ 0 // FsnameLen
+ );
+
+ ok(rc, "GetVolumeInformationW doesn't handle root == \"\\\\:\" case\n");
+}
+
START_TEST(volume)
{
hdll = GetModuleHandleA("kernel32.dll");
@@ -226,6 +271,8 @@
pFindVolumeClose = (void *) GetProcAddress(hdll, "FindVolumeClose");
pGetLogicalDriveStringsA = (void *) GetProcAddress(hdll, "GetLogicalDriveStringsA");
pGetLogicalDriveStringsW = (void *) GetProcAddress(hdll, "GetLogicalDriveStringsW");
+ pGetVolumeInformationW = (void *) GetProcAddress(hdll, "GetVolumeInformationW");
+ pSetCurrentDirectoryA = (void *) GetProcAddress(hdll, "SetCurrentDirectoryA");
test_query_dos_deviceA();
test_FindFirstVolume();
@@ -233,4 +280,5 @@
test_GetVolumeNameForVolumeMountPointW();
test_GetLogicalDriveStringsA();
test_GetLogicalDriveStringsW();
+ test_GetVolumeInformationW();
}
--
G. Paul Ziemba
FreeBSD unix:
10:11AM up 12 days, 20:50, 10 users, load averages: 0.16, 0.18, 0.19
More information about the wine-patches
mailing list