2 * Implementation of the Microsoft Installer (msi.dll)
4 * Copyright 2005 Aric Stewart for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 /* Msi top level apis directly related to installs */
30 #include "wine/debug.h"
37 #include "msiserver.h"
38 #include "wine/unicode.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(msi);
42 /***********************************************************************
43 * MsiDoActionA (MSI.@)
45 UINT WINAPI MsiDoActionA( MSIHANDLE hInstall, LPCSTR szAction )
50 TRACE("%s\n", debugstr_a(szAction));
52 szwAction = strdupAtoW(szAction);
53 if (szAction && !szwAction)
54 return ERROR_FUNCTION_FAILED;
56 ret = MsiDoActionW( hInstall, szwAction );
57 msi_free( szwAction );
61 /***********************************************************************
62 * MsiDoActionW (MSI.@)
64 UINT WINAPI MsiDoActionW( MSIHANDLE hInstall, LPCWSTR szAction )
69 TRACE("%s\n",debugstr_w(szAction));
72 return ERROR_INVALID_PARAMETER;
74 package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE );
79 IWineMsiRemotePackage *remote_package;
81 remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall );
83 return ERROR_INVALID_HANDLE;
85 action = SysAllocString( szAction );
88 IWineMsiRemotePackage_Release( remote_package );
89 return ERROR_OUTOFMEMORY;
92 hr = IWineMsiRemotePackage_DoAction( remote_package, action );
94 SysFreeString( action );
95 IWineMsiRemotePackage_Release( remote_package );
99 if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
100 return HRESULT_CODE(hr);
102 return ERROR_FUNCTION_FAILED;
105 return ERROR_SUCCESS;
108 ret = ACTION_PerformUIAction( package, szAction, SCRIPT_NONE );
109 msiobj_release( &package->hdr );
114 /***********************************************************************
115 * MsiSequenceA (MSI.@)
117 UINT WINAPI MsiSequenceA( MSIHANDLE hInstall, LPCSTR szTable, INT iSequenceMode )
122 TRACE("%s, %d\n", debugstr_a(szTable), iSequenceMode);
124 szwTable = strdupAtoW(szTable);
125 if (szTable && !szwTable)
126 return ERROR_FUNCTION_FAILED;
128 ret = MsiSequenceW( hInstall, szwTable, iSequenceMode );
129 msi_free( szwTable );
133 /***********************************************************************
134 * MsiSequenceW (MSI.@)
136 UINT WINAPI MsiSequenceW( MSIHANDLE hInstall, LPCWSTR szTable, INT iSequenceMode )
141 TRACE("%s, %d\n", debugstr_w(szTable), iSequenceMode);
143 package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE );
148 IWineMsiRemotePackage *remote_package;
150 remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall );
152 return ERROR_INVALID_HANDLE;
154 table = SysAllocString( szTable );
157 IWineMsiRemotePackage_Release( remote_package );
158 return ERROR_OUTOFMEMORY;
161 hr = IWineMsiRemotePackage_Sequence( remote_package, table, iSequenceMode );
163 SysFreeString( table );
164 IWineMsiRemotePackage_Release( remote_package );
168 if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
169 return HRESULT_CODE(hr);
171 return ERROR_FUNCTION_FAILED;
174 return ERROR_SUCCESS;
176 ret = MSI_Sequence( package, szTable );
177 msiobj_release( &package->hdr );
181 UINT msi_strcpy_to_awstring( LPCWSTR str, awstring *awbuf, DWORD *sz )
183 UINT len, r = ERROR_SUCCESS;
185 if (awbuf->str.w && !sz )
186 return ERROR_INVALID_PARAMETER;
193 len = lstrlenW( str );
195 lstrcpynW( awbuf->str.w, str, *sz );
199 len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
202 WideCharToMultiByte( CP_ACP, 0, str, -1, awbuf->str.a, *sz, NULL, NULL );
203 if ( awbuf->str.a && *sz && (len >= *sz) )
204 awbuf->str.a[*sz - 1] = 0;
207 if (awbuf->str.w && len >= *sz)
213 const WCHAR *msi_get_target_folder( MSIPACKAGE *package, const WCHAR *name )
215 MSIFOLDER *folder = msi_get_loaded_folder( package, name );
217 if (!folder) return NULL;
218 if (!folder->ResolvedTarget)
220 MSIFOLDER *parent = folder;
221 while (parent->Parent && strcmpW( parent->Parent, parent->Directory ))
223 parent = msi_get_loaded_folder( package, parent->Parent );
225 msi_resolve_target_folder( package, parent->Directory, TRUE );
227 return folder->ResolvedTarget;
230 /***********************************************************************
231 * MsiGetTargetPath (internal)
233 static UINT MSI_GetTargetPath( MSIHANDLE hInstall, LPCWSTR szFolder,
234 awstring *szPathBuf, LPDWORD pcchPathBuf )
238 UINT r = ERROR_FUNCTION_FAILED;
241 return ERROR_INVALID_PARAMETER;
243 package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE );
247 IWineMsiRemotePackage *remote_package;
252 remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall );
254 return ERROR_INVALID_HANDLE;
256 folder = SysAllocString( szFolder );
259 IWineMsiRemotePackage_Release( remote_package );
260 return ERROR_OUTOFMEMORY;
264 hr = IWineMsiRemotePackage_GetTargetPath( remote_package, folder, NULL, &len );
269 value = msi_alloc(len * sizeof(WCHAR));
272 r = ERROR_OUTOFMEMORY;
276 hr = IWineMsiRemotePackage_GetTargetPath( remote_package, folder, value, &len );
280 r = msi_strcpy_to_awstring( value, szPathBuf, pcchPathBuf );
283 IWineMsiRemotePackage_Release( remote_package );
284 SysFreeString( folder );
289 if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
290 return HRESULT_CODE(hr);
292 return ERROR_FUNCTION_FAILED;
298 path = msi_get_target_folder( package, szFolder );
299 msiobj_release( &package->hdr );
302 return ERROR_DIRECTORY;
304 r = msi_strcpy_to_awstring( path, szPathBuf, pcchPathBuf );
308 /***********************************************************************
309 * MsiGetTargetPathA (MSI.@)
311 UINT WINAPI MsiGetTargetPathA( MSIHANDLE hInstall, LPCSTR szFolder,
312 LPSTR szPathBuf, LPDWORD pcchPathBuf )
318 TRACE("%s %p %p\n", debugstr_a(szFolder), szPathBuf, pcchPathBuf);
320 szwFolder = strdupAtoW(szFolder);
321 if (szFolder && !szwFolder)
322 return ERROR_FUNCTION_FAILED;
324 path.unicode = FALSE;
325 path.str.a = szPathBuf;
327 r = MSI_GetTargetPath( hInstall, szwFolder, &path, pcchPathBuf );
329 msi_free( szwFolder );
334 /***********************************************************************
335 * MsiGetTargetPathW (MSI.@)
337 UINT WINAPI MsiGetTargetPathW( MSIHANDLE hInstall, LPCWSTR szFolder,
338 LPWSTR szPathBuf, LPDWORD pcchPathBuf )
342 TRACE("%s %p %p\n", debugstr_w(szFolder), szPathBuf, pcchPathBuf);
345 path.str.w = szPathBuf;
347 return MSI_GetTargetPath( hInstall, szFolder, &path, pcchPathBuf );
350 static WCHAR *get_source_root( MSIPACKAGE *package )
352 msi_set_sourcedir_props( package, FALSE );
353 return msi_dup_property( package->db, szSourceDir );
356 WCHAR *msi_resolve_source_folder( MSIPACKAGE *package, const WCHAR *name, MSIFOLDER **folder )
359 LPWSTR p, path = NULL, parent;
361 TRACE("working to resolve %s\n", debugstr_w(name));
363 if (!strcmpW( name, szSourceDir )) name = szTargetDir;
364 if (!(f = msi_get_loaded_folder( package, name ))) return NULL;
366 /* special resolving for root dir */
367 if (!strcmpW( name, szTargetDir ) && !f->ResolvedSource)
369 f->ResolvedSource = get_source_root( package );
371 if (folder) *folder = f;
372 if (f->ResolvedSource)
374 path = strdupW( f->ResolvedSource );
375 TRACE(" already resolved to %s\n", debugstr_w(path));
378 if (!f->Parent) return path;
380 TRACE(" ! parent is %s\n", debugstr_w(parent));
382 p = msi_resolve_source_folder( package, parent, NULL );
384 if (package->WordCount & msidbSumInfoSourceTypeCompressed)
385 path = get_source_root( package );
386 else if (package->WordCount & msidbSumInfoSourceTypeSFN)
387 path = msi_build_directory_name( 3, p, f->SourceShortPath, NULL );
389 path = msi_build_directory_name( 3, p, f->SourceLongPath, NULL );
391 TRACE("-> %s\n", debugstr_w(path));
392 f->ResolvedSource = strdupW( path );
398 /***********************************************************************
399 * MSI_GetSourcePath (internal)
401 static UINT MSI_GetSourcePath( MSIHANDLE hInstall, LPCWSTR szFolder,
402 awstring *szPathBuf, LPDWORD pcchPathBuf )
406 UINT r = ERROR_FUNCTION_FAILED;
408 TRACE("%s %p %p\n", debugstr_w(szFolder), szPathBuf, pcchPathBuf );
411 return ERROR_INVALID_PARAMETER;
413 package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE );
417 IWineMsiRemotePackage *remote_package;
422 remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall );
424 return ERROR_INVALID_HANDLE;
426 folder = SysAllocString( szFolder );
429 IWineMsiRemotePackage_Release( remote_package );
430 return ERROR_OUTOFMEMORY;
434 hr = IWineMsiRemotePackage_GetSourcePath( remote_package, folder, NULL, &len );
439 value = msi_alloc(len * sizeof(WCHAR));
442 r = ERROR_OUTOFMEMORY;
446 hr = IWineMsiRemotePackage_GetSourcePath( remote_package, folder, value, &len );
450 r = msi_strcpy_to_awstring( value, szPathBuf, pcchPathBuf );
453 IWineMsiRemotePackage_Release( remote_package );
454 SysFreeString( folder );
459 if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
460 return HRESULT_CODE(hr);
462 return ERROR_FUNCTION_FAILED;
468 if (szPathBuf->str.w && !pcchPathBuf )
470 msiobj_release( &package->hdr );
471 return ERROR_INVALID_PARAMETER;
474 path = msi_resolve_source_folder( package, szFolder, NULL );
475 msiobj_release( &package->hdr );
477 TRACE("path = %s\n", debugstr_w(path));
479 return ERROR_DIRECTORY;
481 r = msi_strcpy_to_awstring( path, szPathBuf, pcchPathBuf );
486 /***********************************************************************
487 * MsiGetSourcePathA (MSI.@)
489 UINT WINAPI MsiGetSourcePathA( MSIHANDLE hInstall, LPCSTR szFolder,
490 LPSTR szPathBuf, LPDWORD pcchPathBuf )
496 TRACE("%s %p %p\n", debugstr_a(szFolder), szPathBuf, pcchPathBuf);
499 str.str.a = szPathBuf;
501 folder = strdupAtoW( szFolder );
502 r = MSI_GetSourcePath( hInstall, folder, &str, pcchPathBuf );
508 /***********************************************************************
509 * MsiGetSourcePathW (MSI.@)
511 UINT WINAPI MsiGetSourcePathW( MSIHANDLE hInstall, LPCWSTR szFolder,
512 LPWSTR szPathBuf, LPDWORD pcchPathBuf )
516 TRACE("%s %p %p\n", debugstr_w(szFolder), szPathBuf, pcchPathBuf );
519 str.str.w = szPathBuf;
521 return MSI_GetSourcePath( hInstall, szFolder, &str, pcchPathBuf );
524 /***********************************************************************
525 * MsiSetTargetPathA (MSI.@)
527 UINT WINAPI MsiSetTargetPathA( MSIHANDLE hInstall, LPCSTR szFolder,
528 LPCSTR szFolderPath )
530 LPWSTR szwFolder = NULL, szwFolderPath = NULL;
531 UINT rc = ERROR_OUTOFMEMORY;
533 if ( !szFolder || !szFolderPath )
534 return ERROR_INVALID_PARAMETER;
536 szwFolder = strdupAtoW(szFolder);
537 szwFolderPath = strdupAtoW(szFolderPath);
538 if (!szwFolder || !szwFolderPath)
541 rc = MsiSetTargetPathW( hInstall, szwFolder, szwFolderPath );
545 msi_free(szwFolderPath);
550 static void set_target_path( MSIPACKAGE *package, MSIFOLDER *folder, const WCHAR *path )
556 if (!(target_path = strdupW( path ))) return;
557 msi_clean_path( target_path );
558 if (strcmpW( target_path, folder->ResolvedTarget ))
560 msi_free( folder->ResolvedTarget );
561 folder->ResolvedTarget = target_path;
562 msi_set_property( package->db, folder->Directory, folder->ResolvedTarget );
564 LIST_FOR_EACH_ENTRY( fl, &folder->children, FolderList, entry )
567 msi_resolve_target_folder( package, child->Directory, FALSE );
570 else msi_free( target_path );
573 UINT MSI_SetTargetPathW( MSIPACKAGE *package, LPCWSTR szFolder, LPCWSTR szFolderPath )
579 TRACE("%p %s %s\n", package, debugstr_w(szFolder), debugstr_w(szFolderPath));
581 attrib = GetFileAttributesW(szFolderPath);
582 /* native MSI tests writeability by making temporary files at each drive */
583 if (attrib != INVALID_FILE_ATTRIBUTES &&
584 (attrib & FILE_ATTRIBUTE_OFFLINE || attrib & FILE_ATTRIBUTE_READONLY))
586 return ERROR_FUNCTION_FAILED;
588 if (!(folder = msi_get_loaded_folder( package, szFolder ))) return ERROR_DIRECTORY;
590 len = strlenW( szFolderPath );
591 if (len && szFolderPath[len - 1] != '\\')
593 WCHAR *path = msi_alloc( (len + 2) * sizeof(WCHAR) );
594 memcpy( path, szFolderPath, len * sizeof(WCHAR) );
597 set_target_path( package, folder, path );
600 else set_target_path( package, folder, szFolderPath );
602 LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
605 MSICOMPONENT *comp = file->Component;
607 if (!comp->Enabled || (comp->assembly && !comp->assembly->application)) continue;
609 dir = msi_get_target_folder( package, comp->Directory );
610 msi_free( file->TargetPath );
611 file->TargetPath = msi_build_directory_name( 2, dir, file->FileName );
613 return ERROR_SUCCESS;
616 /***********************************************************************
617 * MsiSetTargetPathW (MSI.@)
619 UINT WINAPI MsiSetTargetPathW(MSIHANDLE hInstall, LPCWSTR szFolder,
620 LPCWSTR szFolderPath)
625 TRACE("%s %s\n",debugstr_w(szFolder),debugstr_w(szFolderPath));
627 if ( !szFolder || !szFolderPath )
628 return ERROR_INVALID_PARAMETER;
630 package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
635 IWineMsiRemotePackage *remote_package;
637 remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall );
639 return ERROR_INVALID_HANDLE;
641 folder = SysAllocString( szFolder );
642 path = SysAllocString( szFolderPath );
643 if (!folder || !path)
645 SysFreeString(folder);
647 IWineMsiRemotePackage_Release( remote_package );
648 return ERROR_OUTOFMEMORY;
651 hr = IWineMsiRemotePackage_SetTargetPath( remote_package, folder, path );
653 SysFreeString(folder);
655 IWineMsiRemotePackage_Release( remote_package );
659 if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
660 return HRESULT_CODE(hr);
662 return ERROR_FUNCTION_FAILED;
665 return ERROR_SUCCESS;
668 ret = MSI_SetTargetPathW( package, szFolder, szFolderPath );
669 msiobj_release( &package->hdr );
673 /***********************************************************************
676 * Returns an internal installer state (if it is running in a mode iRunMode)
679 * hInstall [I] Handle to the installation
680 * hRunMode [I] Checking run mode
681 * MSIRUNMODE_ADMIN Administrative mode
682 * MSIRUNMODE_ADVERTISE Advertisement mode
683 * MSIRUNMODE_MAINTENANCE Maintenance mode
684 * MSIRUNMODE_ROLLBACKENABLED Rollback is enabled
685 * MSIRUNMODE_LOGENABLED Log file is writing
686 * MSIRUNMODE_OPERATIONS Operations in progress??
687 * MSIRUNMODE_REBOOTATEND We need to reboot after installation completed
688 * MSIRUNMODE_REBOOTNOW We need to reboot to continue the installation
689 * MSIRUNMODE_CABINET Files from cabinet are installed
690 * MSIRUNMODE_SOURCESHORTNAMES Long names in source files is suppressed
691 * MSIRUNMODE_TARGETSHORTNAMES Long names in destination files is suppressed
692 * MSIRUNMODE_RESERVED11 Reserved
693 * MSIRUNMODE_WINDOWS9X Running under Windows95/98
694 * MSIRUNMODE_ZAWENABLED Demand installation is supported
695 * MSIRUNMODE_RESERVED14 Reserved
696 * MSIRUNMODE_RESERVED15 Reserved
697 * MSIRUNMODE_SCHEDULED called from install script
698 * MSIRUNMODE_ROLLBACK called from rollback script
699 * MSIRUNMODE_COMMIT called from commit script
703 * Not in the state: FALSE
706 BOOL WINAPI MsiGetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode)
711 TRACE("%d %d\n", hInstall, iRunMode);
713 package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
718 IWineMsiRemotePackage *remote_package;
720 remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall);
724 hr = IWineMsiRemotePackage_GetMode(remote_package, iRunMode, &ret);
725 IWineMsiRemotePackage_Release(remote_package);
735 case MSIRUNMODE_ADMIN:
736 FIXME("no support for administrative installs\n");
739 case MSIRUNMODE_ADVERTISE:
740 FIXME("no support for advertised installs\n");
743 case MSIRUNMODE_WINDOWS9X:
744 if (GetVersion() & 0x80000000)
748 case MSIRUNMODE_OPERATIONS:
749 case MSIRUNMODE_RESERVED11:
750 case MSIRUNMODE_RESERVED14:
751 case MSIRUNMODE_RESERVED15:
754 case MSIRUNMODE_SCHEDULED:
755 r = package->scheduled_action_running;
758 case MSIRUNMODE_ROLLBACK:
759 r = package->rollback_action_running;
762 case MSIRUNMODE_COMMIT:
763 r = package->commit_action_running;
766 case MSIRUNMODE_MAINTENANCE:
767 r = msi_get_property_int( package->db, szInstalled, 0 ) != 0;
770 case MSIRUNMODE_ROLLBACKENABLED:
771 r = msi_get_property_int( package->db, szRollbackDisabled, 0 ) == 0;
774 case MSIRUNMODE_REBOOTATEND:
775 r = package->need_reboot;
778 case MSIRUNMODE_LOGENABLED:
779 r = (package->log_file != INVALID_HANDLE_VALUE);
783 FIXME("unimplemented run mode: %d\n", iRunMode);
787 msiobj_release( &package->hdr );
791 /***********************************************************************
794 UINT WINAPI MsiSetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode, BOOL fState)
799 TRACE("%d %d %d\n", hInstall, iRunMode, fState);
801 package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE );
805 IWineMsiRemotePackage *remote_package;
807 remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall );
811 hr = IWineMsiRemotePackage_SetMode( remote_package, iRunMode, fState );
812 IWineMsiRemotePackage_Release( remote_package );
816 if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
817 return HRESULT_CODE(hr);
819 return ERROR_FUNCTION_FAILED;
822 return ERROR_SUCCESS;
827 case MSIRUNMODE_REBOOTATEND:
828 package->need_reboot = 1;
832 case MSIRUNMODE_REBOOTNOW:
833 FIXME("unimplemented run mode: %d\n", iRunMode);
834 r = ERROR_FUNCTION_FAILED;
838 r = ERROR_ACCESS_DENIED;
841 msiobj_release( &package->hdr );
845 /***********************************************************************
846 * MsiSetFeatureStateA (MSI.@)
848 * According to the docs, when this is called it immediately recalculates
849 * all the component states as well
851 UINT WINAPI MsiSetFeatureStateA(MSIHANDLE hInstall, LPCSTR szFeature,
854 LPWSTR szwFeature = NULL;
857 szwFeature = strdupAtoW(szFeature);
860 return ERROR_FUNCTION_FAILED;
862 rc = MsiSetFeatureStateW(hInstall,szwFeature, iState);
864 msi_free(szwFeature);
869 /* update component state based on a feature change */
870 void ACTION_UpdateComponentStates( MSIPACKAGE *package, MSIFEATURE *feature )
872 INSTALLSTATE newstate;
875 newstate = feature->ActionRequest;
876 if (newstate == INSTALLSTATE_ABSENT) newstate = INSTALLSTATE_UNKNOWN;
878 LIST_FOR_EACH_ENTRY(cl, &feature->Components, ComponentList, entry)
880 MSICOMPONENT *component = cl->component;
882 if (!component->Enabled) continue;
884 TRACE("Modifying (%d): Component %s (Installed %d, Action %d, Request %d)\n",
885 newstate, debugstr_w(component->Component), component->Installed,
886 component->Action, component->ActionRequest);
888 if (newstate == INSTALLSTATE_LOCAL)
890 component->Action = INSTALLSTATE_LOCAL;
891 component->ActionRequest = INSTALLSTATE_LOCAL;
895 ComponentList *clist;
898 component->hasLocalFeature = FALSE;
900 component->Action = newstate;
901 component->ActionRequest = newstate;
902 /* if any other feature wants it local we need to set it local */
903 LIST_FOR_EACH_ENTRY(f, &package->features, MSIFEATURE, entry)
905 if ( f->ActionRequest != INSTALLSTATE_LOCAL &&
906 f->ActionRequest != INSTALLSTATE_SOURCE )
910 LIST_FOR_EACH_ENTRY(clist, &f->Components, ComponentList, entry)
912 if (clist->component == component &&
913 (f->ActionRequest == INSTALLSTATE_LOCAL ||
914 f->ActionRequest == INSTALLSTATE_SOURCE))
916 TRACE("Saved by %s\n", debugstr_w(f->Feature));
917 component->hasLocalFeature = TRUE;
919 if (component->Attributes & msidbComponentAttributesOptional)
921 if (f->Attributes & msidbFeatureAttributesFavorSource)
923 component->Action = INSTALLSTATE_SOURCE;
924 component->ActionRequest = INSTALLSTATE_SOURCE;
928 component->Action = INSTALLSTATE_LOCAL;
929 component->ActionRequest = INSTALLSTATE_LOCAL;
932 else if (component->Attributes & msidbComponentAttributesSourceOnly)
934 component->Action = INSTALLSTATE_SOURCE;
935 component->ActionRequest = INSTALLSTATE_SOURCE;
939 component->Action = INSTALLSTATE_LOCAL;
940 component->ActionRequest = INSTALLSTATE_LOCAL;
946 TRACE("Result (%d): Component %s (Installed %d, Action %d, Request %d)\n",
947 newstate, debugstr_w(component->Component), component->Installed,
948 component->Action, component->ActionRequest);
952 UINT MSI_SetFeatureStateW( MSIPACKAGE *package, LPCWSTR szFeature, INSTALLSTATE iState )
954 UINT rc = ERROR_SUCCESS;
955 MSIFEATURE *feature, *child;
957 TRACE("%s %i\n", debugstr_w(szFeature), iState);
959 feature = msi_get_loaded_feature( package, szFeature );
961 return ERROR_UNKNOWN_FEATURE;
963 if (iState == INSTALLSTATE_ADVERTISED &&
964 feature->Attributes & msidbFeatureAttributesDisallowAdvertise)
965 return ERROR_FUNCTION_FAILED;
967 feature->ActionRequest = iState;
969 ACTION_UpdateComponentStates( package, feature );
971 /* update all the features that are children of this feature */
972 LIST_FOR_EACH_ENTRY( child, &package->features, MSIFEATURE, entry )
974 if (child->Feature_Parent && !strcmpW( szFeature, child->Feature_Parent ))
975 MSI_SetFeatureStateW(package, child->Feature, iState);
981 /***********************************************************************
982 * MsiSetFeatureStateW (MSI.@)
984 UINT WINAPI MsiSetFeatureStateW(MSIHANDLE hInstall, LPCWSTR szFeature,
988 UINT rc = ERROR_SUCCESS;
990 TRACE("%s %i\n",debugstr_w(szFeature), iState);
992 package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
997 IWineMsiRemotePackage *remote_package;
999 remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall);
1000 if (!remote_package)
1001 return ERROR_INVALID_HANDLE;
1003 feature = SysAllocString(szFeature);
1006 IWineMsiRemotePackage_Release(remote_package);
1007 return ERROR_OUTOFMEMORY;
1010 hr = IWineMsiRemotePackage_SetFeatureState(remote_package, feature, iState);
1012 SysFreeString(feature);
1013 IWineMsiRemotePackage_Release(remote_package);
1017 if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
1018 return HRESULT_CODE(hr);
1020 return ERROR_FUNCTION_FAILED;
1023 return ERROR_SUCCESS;
1026 rc = MSI_SetFeatureStateW(package,szFeature,iState);
1028 msiobj_release( &package->hdr );
1032 /***********************************************************************
1033 * MsiSetFeatureAttributesA (MSI.@)
1035 UINT WINAPI MsiSetFeatureAttributesA( MSIHANDLE handle, LPCSTR feature, DWORD attrs )
1038 WCHAR *featureW = NULL;
1040 TRACE("%u, %s, 0x%08x\n", handle, debugstr_a(feature), attrs);
1042 if (feature && !(featureW = strdupAtoW( feature ))) return ERROR_OUTOFMEMORY;
1044 r = MsiSetFeatureAttributesW( handle, featureW, attrs );
1045 msi_free( featureW );
1049 static DWORD unmap_feature_attributes( DWORD attrs )
1053 if (attrs & INSTALLFEATUREATTRIBUTE_FAVORLOCAL) ret = msidbFeatureAttributesFavorLocal;
1054 if (attrs & INSTALLFEATUREATTRIBUTE_FAVORSOURCE) ret |= msidbFeatureAttributesFavorSource;
1055 if (attrs & INSTALLFEATUREATTRIBUTE_FOLLOWPARENT) ret |= msidbFeatureAttributesFollowParent;
1056 if (attrs & INSTALLFEATUREATTRIBUTE_FAVORADVERTISE) ret |= msidbFeatureAttributesFavorAdvertise;
1057 if (attrs & INSTALLFEATUREATTRIBUTE_DISALLOWADVERTISE) ret |= msidbFeatureAttributesDisallowAdvertise;
1058 if (attrs & INSTALLFEATUREATTRIBUTE_NOUNSUPPORTEDADVERTISE) ret |= msidbFeatureAttributesNoUnsupportedAdvertise;
1062 /***********************************************************************
1063 * MsiSetFeatureAttributesW (MSI.@)
1065 UINT WINAPI MsiSetFeatureAttributesW( MSIHANDLE handle, LPCWSTR name, DWORD attrs )
1067 MSIPACKAGE *package;
1068 MSIFEATURE *feature;
1071 TRACE("%u, %s, 0x%08x\n", handle, debugstr_w(name), attrs);
1073 if (!name || !name[0]) return ERROR_UNKNOWN_FEATURE;
1075 if (!(package = msihandle2msiinfo( handle, MSIHANDLETYPE_PACKAGE )))
1076 return ERROR_INVALID_HANDLE;
1078 costing = msi_dup_property( package->db, szCostingComplete );
1079 if (!costing || !strcmpW( costing, szOne ))
1081 msi_free( costing );
1082 msiobj_release( &package->hdr );
1083 return ERROR_FUNCTION_FAILED;
1085 msi_free( costing );
1086 if (!(feature = msi_get_loaded_feature( package, name )))
1088 msiobj_release( &package->hdr );
1089 return ERROR_UNKNOWN_FEATURE;
1091 feature->Attributes = unmap_feature_attributes( attrs );
1092 msiobj_release( &package->hdr );
1093 return ERROR_SUCCESS;
1096 /***********************************************************************
1097 * MsiGetFeatureStateA (MSI.@)
1099 UINT WINAPI MsiGetFeatureStateA(MSIHANDLE hInstall, LPCSTR szFeature,
1100 INSTALLSTATE *piInstalled, INSTALLSTATE *piAction)
1102 LPWSTR szwFeature = NULL;
1105 if (szFeature && !(szwFeature = strdupAtoW(szFeature))) return ERROR_OUTOFMEMORY;
1107 rc = MsiGetFeatureStateW(hInstall, szwFeature, piInstalled, piAction);
1108 msi_free( szwFeature);
1112 UINT MSI_GetFeatureStateW(MSIPACKAGE *package, LPCWSTR szFeature,
1113 INSTALLSTATE *piInstalled, INSTALLSTATE *piAction)
1115 MSIFEATURE *feature;
1117 feature = msi_get_loaded_feature(package,szFeature);
1119 return ERROR_UNKNOWN_FEATURE;
1122 *piInstalled = feature->Installed;
1125 *piAction = feature->ActionRequest;
1127 TRACE("returning %i %i\n", feature->Installed, feature->ActionRequest);
1129 return ERROR_SUCCESS;
1132 /***********************************************************************
1133 * MsiGetFeatureStateW (MSI.@)
1135 UINT WINAPI MsiGetFeatureStateW(MSIHANDLE hInstall, LPCWSTR szFeature,
1136 INSTALLSTATE *piInstalled, INSTALLSTATE *piAction)
1138 MSIPACKAGE* package;
1141 TRACE("%d %s %p %p\n", hInstall, debugstr_w(szFeature), piInstalled, piAction);
1143 package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
1148 IWineMsiRemotePackage *remote_package;
1150 remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall);
1151 if (!remote_package)
1152 return ERROR_INVALID_HANDLE;
1154 feature = SysAllocString(szFeature);
1157 IWineMsiRemotePackage_Release(remote_package);
1158 return ERROR_OUTOFMEMORY;
1161 hr = IWineMsiRemotePackage_GetFeatureState(remote_package, feature,
1162 piInstalled, piAction);
1164 SysFreeString(feature);
1165 IWineMsiRemotePackage_Release(remote_package);
1169 if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
1170 return HRESULT_CODE(hr);
1172 return ERROR_FUNCTION_FAILED;
1175 return ERROR_SUCCESS;
1178 ret = MSI_GetFeatureStateW(package, szFeature, piInstalled, piAction);
1179 msiobj_release( &package->hdr );
1183 /***********************************************************************
1184 * MsiGetFeatureCostA (MSI.@)
1186 UINT WINAPI MsiGetFeatureCostA(MSIHANDLE hInstall, LPCSTR szFeature,
1187 MSICOSTTREE iCostTree, INSTALLSTATE iState, LPINT piCost)
1189 LPWSTR szwFeature = NULL;
1192 szwFeature = strdupAtoW(szFeature);
1194 rc = MsiGetFeatureCostW(hInstall, szwFeature, iCostTree, iState, piCost);
1196 msi_free(szwFeature);
1201 static INT feature_cost( MSIFEATURE *feature )
1206 LIST_FOR_EACH_ENTRY( comp, &feature->Components, MSICOMPONENT, entry )
1213 UINT MSI_GetFeatureCost( MSIPACKAGE *package, MSIFEATURE *feature, MSICOSTTREE tree,
1214 INSTALLSTATE state, LPINT cost )
1216 TRACE("%s, %u, %d, %p\n", debugstr_w(feature->Feature), tree, state, cost);
1221 case MSICOSTTREE_CHILDREN:
1225 LIST_FOR_EACH_ENTRY( child, &feature->Children, MSIFEATURE, entry )
1227 if (child->ActionRequest == state)
1228 *cost += feature_cost( child );
1232 case MSICOSTTREE_PARENTS:
1234 const WCHAR *feature_parent = feature->Feature_Parent;
1237 MSIFEATURE *parent = msi_get_loaded_feature( package, feature_parent );
1241 if (parent->ActionRequest == state)
1242 *cost += feature_cost( parent );
1244 feature_parent = parent->Feature_Parent;
1248 case MSICOSTTREE_SELFONLY:
1249 if (feature->ActionRequest == state)
1250 *cost = feature_cost( feature );
1254 WARN("unhandled cost tree %u\n", tree);
1259 return ERROR_SUCCESS;
1262 /***********************************************************************
1263 * MsiGetFeatureCostW (MSI.@)
1265 UINT WINAPI MsiGetFeatureCostW(MSIHANDLE hInstall, LPCWSTR szFeature,
1266 MSICOSTTREE iCostTree, INSTALLSTATE iState, LPINT piCost)
1268 MSIPACKAGE *package;
1269 MSIFEATURE *feature;
1272 TRACE("(%d %s %i %i %p)\n", hInstall, debugstr_w(szFeature),
1273 iCostTree, iState, piCost);
1275 package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
1280 IWineMsiRemotePackage *remote_package;
1282 remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall);
1283 if (!remote_package)
1284 return ERROR_INVALID_HANDLE;
1286 feature = SysAllocString(szFeature);
1289 IWineMsiRemotePackage_Release(remote_package);
1290 return ERROR_OUTOFMEMORY;
1293 hr = IWineMsiRemotePackage_GetFeatureCost(remote_package, feature,
1294 iCostTree, iState, piCost);
1296 SysFreeString(feature);
1297 IWineMsiRemotePackage_Release(remote_package);
1301 if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
1302 return HRESULT_CODE(hr);
1304 return ERROR_FUNCTION_FAILED;
1307 return ERROR_SUCCESS;
1310 feature = msi_get_loaded_feature(package, szFeature);
1313 ret = MSI_GetFeatureCost(package, feature, iCostTree, iState, piCost);
1315 ret = ERROR_UNKNOWN_FEATURE;
1317 msiobj_release( &package->hdr );
1321 /***********************************************************************
1322 * MsiGetFeatureInfoA (MSI.@)
1324 UINT WINAPI MsiGetFeatureInfoA( MSIHANDLE handle, LPCSTR feature, LPDWORD attrs,
1325 LPSTR title, LPDWORD title_len, LPSTR help, LPDWORD help_len )
1328 WCHAR *titleW = NULL, *helpW = NULL, *featureW = NULL;
1330 TRACE("%u, %s, %p, %p, %p, %p, %p\n", handle, debugstr_a(feature), attrs, title,
1331 title_len, help, help_len);
1333 if (feature && !(featureW = strdupAtoW( feature ))) return ERROR_OUTOFMEMORY;
1335 if (title && title_len && !(titleW = msi_alloc( *title_len * sizeof(WCHAR) )))
1337 msi_free( featureW );
1338 return ERROR_OUTOFMEMORY;
1340 if (help && help_len && !(helpW = msi_alloc( *help_len * sizeof(WCHAR) )))
1342 msi_free( featureW );
1344 return ERROR_OUTOFMEMORY;
1346 r = MsiGetFeatureInfoW( handle, featureW, attrs, titleW, title_len, helpW, help_len );
1347 if (r == ERROR_SUCCESS)
1349 if (titleW) WideCharToMultiByte( CP_ACP, 0, titleW, -1, title, *title_len + 1, NULL, NULL );
1350 if (helpW) WideCharToMultiByte( CP_ACP, 0, helpW, -1, help, *help_len + 1, NULL, NULL );
1354 msi_free( featureW );
1358 static DWORD map_feature_attributes( DWORD attrs )
1362 if (attrs == msidbFeatureAttributesFavorLocal) ret |= INSTALLFEATUREATTRIBUTE_FAVORLOCAL;
1363 if (attrs & msidbFeatureAttributesFavorSource) ret |= INSTALLFEATUREATTRIBUTE_FAVORSOURCE;
1364 if (attrs & msidbFeatureAttributesFollowParent) ret |= INSTALLFEATUREATTRIBUTE_FOLLOWPARENT;
1365 if (attrs & msidbFeatureAttributesFavorAdvertise) ret |= INSTALLFEATUREATTRIBUTE_FAVORADVERTISE;
1366 if (attrs & msidbFeatureAttributesDisallowAdvertise) ret |= INSTALLFEATUREATTRIBUTE_DISALLOWADVERTISE;
1367 if (attrs & msidbFeatureAttributesNoUnsupportedAdvertise) ret |= INSTALLFEATUREATTRIBUTE_NOUNSUPPORTEDADVERTISE;
1371 static UINT MSI_GetFeatureInfo( MSIPACKAGE *package, LPCWSTR name, LPDWORD attrs,
1372 LPWSTR title, LPDWORD title_len, LPWSTR help, LPDWORD help_len )
1374 UINT r = ERROR_SUCCESS;
1375 MSIFEATURE *feature = msi_get_loaded_feature( package, name );
1378 if (!feature) return ERROR_UNKNOWN_FEATURE;
1379 if (attrs) *attrs = map_feature_attributes( feature->Attributes );
1382 if (feature->Title) len = strlenW( feature->Title );
1384 if (*title_len <= len)
1387 if (title) r = ERROR_MORE_DATA;
1391 if (feature->Title) strcpyW( title, feature->Title );
1398 if (feature->Description) len = strlenW( feature->Description );
1400 if (*help_len <= len)
1403 if (help) r = ERROR_MORE_DATA;
1407 if (feature->Description) strcpyW( help, feature->Description );
1415 /***********************************************************************
1416 * MsiGetFeatureInfoW (MSI.@)
1418 UINT WINAPI MsiGetFeatureInfoW( MSIHANDLE handle, LPCWSTR feature, LPDWORD attrs,
1419 LPWSTR title, LPDWORD title_len, LPWSTR help, LPDWORD help_len )
1422 MSIPACKAGE *package;
1424 TRACE("%u, %s, %p, %p, %p, %p, %p\n", handle, debugstr_w(feature), attrs, title,
1425 title_len, help, help_len);
1427 if (!feature) return ERROR_INVALID_PARAMETER;
1429 if (!(package = msihandle2msiinfo( handle, MSIHANDLETYPE_PACKAGE )))
1430 return ERROR_INVALID_HANDLE;
1432 /* features may not have been loaded yet */
1433 msi_load_all_components( package );
1434 msi_load_all_features( package );
1436 r = MSI_GetFeatureInfo( package, feature, attrs, title, title_len, help, help_len );
1437 msiobj_release( &package->hdr );
1441 /***********************************************************************
1442 * MsiSetComponentStateA (MSI.@)
1444 UINT WINAPI MsiSetComponentStateA(MSIHANDLE hInstall, LPCSTR szComponent,
1445 INSTALLSTATE iState)
1448 LPWSTR szwComponent = strdupAtoW(szComponent);
1450 rc = MsiSetComponentStateW(hInstall, szwComponent, iState);
1452 msi_free(szwComponent);
1457 /***********************************************************************
1458 * MsiGetComponentStateA (MSI.@)
1460 UINT WINAPI MsiGetComponentStateA(MSIHANDLE hInstall, LPCSTR szComponent,
1461 INSTALLSTATE *piInstalled, INSTALLSTATE *piAction)
1463 LPWSTR szwComponent= NULL;
1466 szwComponent= strdupAtoW(szComponent);
1468 rc = MsiGetComponentStateW(hInstall,szwComponent,piInstalled, piAction);
1470 msi_free( szwComponent);
1475 static UINT MSI_SetComponentStateW(MSIPACKAGE *package, LPCWSTR szComponent,
1476 INSTALLSTATE iState)
1480 TRACE("%p %s %d\n", package, debugstr_w(szComponent), iState);
1482 comp = msi_get_loaded_component(package, szComponent);
1484 return ERROR_UNKNOWN_COMPONENT;
1487 comp->Action = iState;
1489 return ERROR_SUCCESS;
1492 UINT MSI_GetComponentStateW(MSIPACKAGE *package, LPCWSTR szComponent,
1493 INSTALLSTATE *piInstalled, INSTALLSTATE *piAction)
1497 TRACE("%p %s %p %p\n", package, debugstr_w(szComponent),
1498 piInstalled, piAction);
1500 comp = msi_get_loaded_component(package,szComponent);
1502 return ERROR_UNKNOWN_COMPONENT;
1507 *piInstalled = comp->Installed;
1509 *piInstalled = INSTALLSTATE_UNKNOWN;
1515 *piAction = comp->Action;
1517 *piAction = INSTALLSTATE_UNKNOWN;
1520 TRACE("states (%i, %i)\n", comp->Installed, comp->Action );
1521 return ERROR_SUCCESS;
1524 /***********************************************************************
1525 * MsiSetComponentStateW (MSI.@)
1527 UINT WINAPI MsiSetComponentStateW(MSIHANDLE hInstall, LPCWSTR szComponent,
1528 INSTALLSTATE iState)
1530 MSIPACKAGE* package;
1533 package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
1538 IWineMsiRemotePackage *remote_package;
1540 remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall);
1541 if (!remote_package)
1542 return ERROR_INVALID_HANDLE;
1544 component = SysAllocString(szComponent);
1547 IWineMsiRemotePackage_Release(remote_package);
1548 return ERROR_OUTOFMEMORY;
1551 hr = IWineMsiRemotePackage_SetComponentState(remote_package, component, iState);
1553 SysFreeString(component);
1554 IWineMsiRemotePackage_Release(remote_package);
1558 if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
1559 return HRESULT_CODE(hr);
1561 return ERROR_FUNCTION_FAILED;
1564 return ERROR_SUCCESS;
1567 ret = MSI_SetComponentStateW(package, szComponent, iState);
1568 msiobj_release(&package->hdr);
1572 /***********************************************************************
1573 * MsiGetComponentStateW (MSI.@)
1575 UINT WINAPI MsiGetComponentStateW(MSIHANDLE hInstall, LPCWSTR szComponent,
1576 INSTALLSTATE *piInstalled, INSTALLSTATE *piAction)
1578 MSIPACKAGE* package;
1581 TRACE("%d %s %p %p\n", hInstall, debugstr_w(szComponent),
1582 piInstalled, piAction);
1584 package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
1589 IWineMsiRemotePackage *remote_package;
1591 remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall);
1592 if (!remote_package)
1593 return ERROR_INVALID_HANDLE;
1595 component = SysAllocString(szComponent);
1598 IWineMsiRemotePackage_Release(remote_package);
1599 return ERROR_OUTOFMEMORY;
1602 hr = IWineMsiRemotePackage_GetComponentState(remote_package, component,
1603 piInstalled, piAction);
1605 SysFreeString(component);
1606 IWineMsiRemotePackage_Release(remote_package);
1610 if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
1611 return HRESULT_CODE(hr);
1613 return ERROR_FUNCTION_FAILED;
1616 return ERROR_SUCCESS;
1619 ret = MSI_GetComponentStateW( package, szComponent, piInstalled, piAction);
1620 msiobj_release( &package->hdr );
1624 /***********************************************************************
1625 * MsiGetLanguage (MSI.@)
1627 LANGID WINAPI MsiGetLanguage(MSIHANDLE hInstall)
1629 MSIPACKAGE* package;
1632 package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
1637 IWineMsiRemotePackage *remote_package;
1639 remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall);
1640 if (!remote_package)
1641 return ERROR_INVALID_HANDLE;
1643 hr = IWineMsiRemotePackage_GetLanguage(remote_package, &lang);
1651 langid = msi_get_property_int( package->db, szProductLanguage, 0 );
1652 msiobj_release( &package->hdr );
1656 UINT MSI_SetInstallLevel( MSIPACKAGE *package, int iInstallLevel )
1658 static const WCHAR fmt[] = { '%','d',0 };
1662 TRACE("%p %i\n", package, iInstallLevel);
1664 if (iInstallLevel > 32767)
1665 return ERROR_INVALID_PARAMETER;
1667 if (iInstallLevel < 1)
1668 return MSI_SetFeatureStates( package );
1670 sprintfW( level, fmt, iInstallLevel );
1671 r = msi_set_property( package->db, szInstallLevel, level );
1672 if ( r == ERROR_SUCCESS )
1673 r = MSI_SetFeatureStates( package );
1678 /***********************************************************************
1679 * MsiSetInstallLevel (MSI.@)
1681 UINT WINAPI MsiSetInstallLevel(MSIHANDLE hInstall, int iInstallLevel)
1683 MSIPACKAGE* package;
1686 TRACE("%d %i\n", hInstall, iInstallLevel);
1688 package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
1692 IWineMsiRemotePackage *remote_package;
1694 remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall);
1695 if (!remote_package)
1696 return ERROR_INVALID_HANDLE;
1698 hr = IWineMsiRemotePackage_SetInstallLevel(remote_package, iInstallLevel);
1700 IWineMsiRemotePackage_Release(remote_package);
1704 if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
1705 return HRESULT_CODE(hr);
1707 return ERROR_FUNCTION_FAILED;
1710 return ERROR_SUCCESS;
1713 r = MSI_SetInstallLevel( package, iInstallLevel );
1715 msiobj_release( &package->hdr );
1720 /***********************************************************************
1721 * MsiGetFeatureValidStatesW (MSI.@)
1723 UINT WINAPI MsiGetFeatureValidStatesW(MSIHANDLE hInstall, LPCWSTR szFeature,
1724 LPDWORD pInstallState)
1726 if(pInstallState) *pInstallState = 1<<INSTALLSTATE_LOCAL;
1727 FIXME("%d %s %p stub returning %d\n",
1728 hInstall, debugstr_w(szFeature), pInstallState, pInstallState ? *pInstallState : 0);
1730 return ERROR_SUCCESS;
1733 /***********************************************************************
1734 * MsiGetFeatureValidStatesA (MSI.@)
1736 UINT WINAPI MsiGetFeatureValidStatesA(MSIHANDLE hInstall, LPCSTR szFeature,
1737 LPDWORD pInstallState)
1740 LPWSTR szwFeature = strdupAtoW(szFeature);
1742 ret = MsiGetFeatureValidStatesW(hInstall, szwFeature, pInstallState);
1744 msi_free(szwFeature);