Hans Leidekker : msi: GetDriveType and GetVolumeInformation require a path terminated by a slash .

Alexandre Julliard julliard at winehq.org
Wed Sep 16 15:59:33 CDT 2009


Module: wine
Branch: master
Commit: 60d0cf41b36d2f7caa67830829d4f139218343d3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=60d0cf41b36d2f7caa67830829d4f139218343d3

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Tue Sep 15 09:28:41 2009 +0200

msi: GetDriveType and GetVolumeInformation require a path terminated by a slash.

---

 dlls/msi/media.c |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/dlls/msi/media.c b/dlls/msi/media.c
index 7c9dc15..15564cd 100644
--- a/dlls/msi/media.c
+++ b/dlls/msi/media.c
@@ -49,11 +49,16 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi);
 #define _O_TEXT        0x4000
 #define _O_BINARY      0x8000
 
-static BOOL source_matches_volume(MSIMEDIAINFO *mi, LPWSTR source_root)
+static BOOL source_matches_volume(MSIMEDIAINFO *mi, LPCWSTR source_root)
 {
     WCHAR volume_name[MAX_PATH + 1];
+    WCHAR root[MAX_PATH + 1];
 
-    if (!GetVolumeInformationW(source_root, volume_name, MAX_PATH + 1,
+    strcpyW(root, source_root);
+    PathStripToRootW(root);
+    PathAddBackslashW(root);
+
+    if (!GetVolumeInformationW(root, volume_name, MAX_PATH + 1,
                                NULL, NULL, NULL, NULL, 0))
     {
         ERR("Failed to get volume information\n");
@@ -80,7 +85,6 @@ static UINT msi_change_media(MSIPACKAGE *package, MSIMEDIAINFO *mi)
     error = generate_error_string(package, 1302, 1, mi->disk_prompt);
     error_dialog = msi_dup_property(package, error_prop);
     source_dir = msi_dup_property(package, cszSourceDir);
-    PathStripToRootW(source_dir);
 
     while (r == ERROR_SUCCESS &&
            !source_matches_volume(mi, source_dir))
@@ -463,6 +467,17 @@ void msi_free_media_info(MSIMEDIAINFO *mi)
     msi_free(mi);
 }
 
+static UINT get_drive_type(const WCHAR *path)
+{
+    WCHAR root[MAX_PATH + 1];
+
+    strcpyW(root, path);
+    PathStripToRootW(root);
+    PathAddBackslashW(root);
+
+    return GetDriveTypeW(root);
+}
+
 static UINT msi_load_media_info(MSIPACKAGE *package, MSIFILE *file, MSIMEDIAINFO *mi)
 {
     MSIRECORD *row;
@@ -502,9 +517,7 @@ static UINT msi_load_media_info(MSIPACKAGE *package, MSIFILE *file, MSIMEDIAINFO
 
     source_dir = msi_dup_property(package, cszSourceDir);
     lstrcpyW(mi->source, source_dir);
-
-    PathStripToRootW(source_dir);
-    mi->type = GetDriveTypeW(source_dir);
+    mi->type = get_drive_type(source_dir);
 
     if (file->IsCompressed && mi->cabinet)
     {




More information about the wine-cvs mailing list