diff --git a/dlls/msi/action.c b/dlls/msi/action.c index 0e931a1..e579e36 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -648,6 +648,30 @@ static UINT msi_set_sourcedir_props(MSIPACKAGE *package, BOOL replace) return ERROR_SUCCESS; } +static UINT msi_set_context(MSIPACKAGE *package) +{ + WCHAR val[10]; + DWORD sz = 10; + DWORD num; + UINT r; + + static const WCHAR szOne[] = {'1',0}; + static const WCHAR szAllUsers[] = {'A','L','L','U','S','E','R','S',0}; + + package->Context = MSIINSTALLCONTEXT_USERUNMANAGED; + + r = MSI_GetPropertyW(package, szAllUsers, val, &sz); + if (r == ERROR_SUCCESS) + { + num = atolW(val); + if (num == 1 || num == 2) + package->Context = MSIINSTALLCONTEXT_MACHINE; + } + + MSI_SetPropertyW(package, szAllUsers, szOne); + return ERROR_SUCCESS; +} + /**************************************************** * TOP level entry points *****************************************************/ @@ -710,6 +734,7 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, /* properties may have been added by a transform */ msi_clone_properties( package ); + msi_set_context( package ); if ( (msi_get_property_int(package, szUILevel, 0) & INSTALLUILEVEL_MASK) >= INSTALLUILEVEL_REDUCED ) { diff --git a/dlls/msi/package.c b/dlls/msi/package.c index f11b068..0b9dacf 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -760,30 +760,6 @@ static UINT msi_load_admin_properties(MSIPACKAGE *package) return r; } -static UINT msi_set_context(MSIPACKAGE *package) -{ - WCHAR val[10]; - DWORD sz = 10; - DWORD num; - UINT r; - - static const WCHAR szOne[] = {'1',0}; - static const WCHAR szAllUsers[] = {'A','L','L','U','S','E','R','S',0}; - - package->Context = MSIINSTALLCONTEXT_USERUNMANAGED; - - r = MSI_GetPropertyW(package, szAllUsers, val, &sz); - if (r == ERROR_SUCCESS) - { - num = atolW(val); - if (num == 1 || num == 2) - package->Context = MSIINSTALLCONTEXT_MACHINE; - } - - MSI_SetPropertyW(package, szAllUsers, szOne); - return ERROR_SUCCESS; -} - MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db, LPCWSTR base_url ) { static const WCHAR szLevel[] = { 'U','I','L','e','v','e','l',0 }; @@ -823,8 +799,6 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db, LPCWSTR base_url ) if (package->WordCount & MSIWORDCOUNT_ADMINISTRATIVE) msi_load_admin_properties( package ); - - msi_set_context( package ); } return package; -- 1.5.4.3