Hans Leidekker : msi: Factor out common code from MsiEnumComponentCostsW.
Alexandre Julliard
julliard at winehq.org
Fri May 20 12:44:31 CDT 2011
Module: wine
Branch: master
Commit: 4a1c243e6a0827ac1e2c0a36678fd4935a7915e6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4a1c243e6a0827ac1e2c0a36678fd4935a7915e6
Author: Hans Leidekker <hans at codeweavers.com>
Date: Fri May 20 12:32:23 2011 +0200
msi: Factor out common code from MsiEnumComponentCostsW.
---
dlls/msi/msi.c | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c
index 0f11024..5075756 100644
--- a/dlls/msi/msi.c
+++ b/dlls/msi/msi.c
@@ -1825,6 +1825,14 @@ UINT WINAPI MsiEnumComponentCostsA( MSIHANDLE handle, LPCSTR component, DWORD in
return r;
}
+static UINT set_drive( WCHAR *buffer, WCHAR letter )
+{
+ buffer[0] = letter;
+ buffer[1] = ':';
+ buffer[2] = 0;
+ return 2;
+}
+
UINT WINAPI MsiEnumComponentCostsW( MSIHANDLE handle, LPCWSTR component, DWORD index,
INSTALLSTATE state, LPWSTR drive, DWORD *buflen,
int *cost, int *temp )
@@ -1896,29 +1904,20 @@ UINT WINAPI MsiEnumComponentCostsW( MSIHANDLE handle, LPCWSTR component, DWORD i
if (!comp->Enabled || !comp->KeyPath)
{
*cost = 0;
- drive[0] = path[0];
- drive[1] = ':';
- drive[2] = 0;
- *buflen = 2;
+ *buflen = set_drive( drive, path[0] );
r = ERROR_SUCCESS;
}
else if ((file = msi_get_loaded_file( package, comp->KeyPath )))
{
*cost = max( 8, comp->Cost / 512 );
- drive[0] = file->TargetPath[0];
- drive[1] = ':';
- drive[2] = 0;
- *buflen = 2;
+ *buflen = set_drive( drive, file->TargetPath[0] );
r = ERROR_SUCCESS;
}
}
else if (IStorage_Stat( package->db->storage, &stat, STATFLAG_NONAME ) == S_OK)
{
*temp = max( 8, stat.cbSize.QuadPart / 512 );
- drive[0] = path[0];
- drive[1] = ':';
- drive[2] = 0;
- *buflen = 2;
+ *buflen = set_drive( drive, path[0] );
r = ERROR_SUCCESS;
}
msiobj_release( &package->hdr );
More information about the wine-cvs
mailing list