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

This commit is contained in:
Hans Leidekker 2009-09-15 09:28:41 +02:00 committed by Alexandre Julliard
parent fc15d6d5ad
commit 60d0cf41b3
1 changed files with 19 additions and 6 deletions

View File

@ -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)
{