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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * Here are helper functions formally in action.c that are used by a variaty of
23 * actions and functions.
31 #include "wine/debug.h"
34 #include "wine/unicode.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(msi);
39 static const WCHAR cszTargetDir[] = {'T','A','R','G','E','T','D','I','R',0};
40 static const WCHAR cszDatabase[]={'D','A','T','A','B','A','S','E',0};
42 const WCHAR cszSourceDir[] = {'S','o','u','r','c','e','D','i','r',0};
43 const WCHAR cszRootDrive[] = {'R','O','O','T','D','R','I','V','E',0};
44 const WCHAR cszbs[]={'\\',0};
46 DWORD build_version_dword(LPCWSTR version_string)
50 DWORD rc = 0x00000000;
53 ptr1 = version_string;
62 ptr1 = strchrW(ptr1,'.');
72 ptr1 = strchrW(ptr1,'.');
82 rc = MAKELONG(build,MAKEWORD(minor,major));
83 TRACE("%s -> 0x%lx\n",debugstr_w(version_string),rc);
87 UINT build_icon_path(MSIPACKAGE *package, LPCWSTR icon_name,
93 static const WCHAR szInstaller[] =
94 {'M','i','c','r','o','s','o','f','t','\\',
95 'I','n','s','t','a','l','l','e','r','\\',0};
96 static const WCHAR szFolder[] =
97 {'A','p','p','D','a','t','a','F','o','l','d','e','r',0};
99 SystemFolder = load_dynamic_property(package,szFolder,NULL);
101 dest = build_directory_name(3, SystemFolder, szInstaller, package->ProductCode);
103 create_full_pathW(dest);
105 *FilePath = build_directory_name(2, dest, icon_name);
107 HeapFree(GetProcessHeap(),0,SystemFolder);
108 HeapFree(GetProcessHeap(),0,dest);
109 return ERROR_SUCCESS;
112 WCHAR *load_dynamic_stringW(MSIRECORD *row, INT index)
119 if (MSI_RecordIsNull(row,index))
122 rc = MSI_RecordGetStringW(row,index,NULL,&sz);
124 /* having an empty string is different than NULL */
127 ret = HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR));
133 ret = HeapAlloc(GetProcessHeap(),0,sz * sizeof (WCHAR));
134 rc = MSI_RecordGetStringW(row,index,ret,&sz);
135 if (rc!=ERROR_SUCCESS)
137 ERR("Unable to load dynamic string\n");
138 HeapFree(GetProcessHeap(), 0, ret);
144 LPWSTR load_dynamic_property(MSIPACKAGE *package, LPCWSTR prop, UINT* rc)
150 r = MSI_GetPropertyW(package, prop, NULL, &sz);
151 if (r != ERROR_SUCCESS && r != ERROR_MORE_DATA)
158 str = HeapAlloc(GetProcessHeap(),0,sz*sizeof(WCHAR));
159 r = MSI_GetPropertyW(package, prop, str, &sz);
160 if (r != ERROR_SUCCESS)
162 HeapFree(GetProcessHeap(),0,str);
170 MSICOMPONENT* get_loaded_component( MSIPACKAGE* package, LPCWSTR Component )
174 LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry )
176 if (lstrcmpW(Component,comp->Component)==0)
182 MSIFEATURE* get_loaded_feature(MSIPACKAGE* package, LPCWSTR Feature )
186 LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
188 if (lstrcmpW( Feature, feature->Feature )==0)
194 MSIFILE* get_loaded_file( MSIPACKAGE* package, LPCWSTR key )
198 LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
200 if (lstrcmpW( key, file->File )==0)
206 int track_tempfile( MSIPACKAGE *package, LPCWSTR name, LPCWSTR path )
213 file = get_loaded_file( package, name );
217 file = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof (MSIFILE) );
219 file->File = strdupW( name );
220 file->TargetPath = strdupW( path );
221 file->Temporary = TRUE;
223 TRACE("Tracking tempfile (%s)\n", debugstr_w( file->File ));
228 MSIFOLDER *get_loaded_folder( MSIPACKAGE *package, LPCWSTR dir )
232 LIST_FOR_EACH_ENTRY( folder, &package->folders, MSIFOLDER, entry )
234 if (lstrcmpW( dir, folder->Directory )==0)
240 LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
241 BOOL set_prop, MSIFOLDER **folder)
244 LPWSTR p, path = NULL;
246 TRACE("Working to resolve %s\n",debugstr_w(name));
251 /* special resolving for Target and Source root dir */
252 if (strcmpW(name,cszTargetDir)==0 || strcmpW(name,cszSourceDir)==0)
257 check_path = load_dynamic_property(package,cszTargetDir,NULL);
260 check_path = load_dynamic_property(package,cszRootDrive,NULL);
262 MSI_SetPropertyW(package,cszTargetDir,check_path);
265 /* correct misbuilt target dir */
266 path = build_directory_name(2, check_path, NULL);
267 if (strcmpiW(path,check_path)!=0)
268 MSI_SetPropertyW(package,cszTargetDir,path);
272 path = load_dynamic_property(package,cszSourceDir,NULL);
275 path = load_dynamic_property(package,cszDatabase,NULL);
278 p = strrchrW(path,'\\');
285 *folder = get_loaded_folder( package, name );
289 f = get_loaded_folder( package, name );
296 if (!source && f->ResolvedTarget)
298 path = strdupW( f->ResolvedTarget );
299 TRACE(" already resolved to %s\n",debugstr_w(path));
302 else if (source && f->ResolvedSource)
304 path = strdupW( f->ResolvedSource );
305 TRACE(" (source)already resolved to %s\n",debugstr_w(path));
308 else if (!source && f->Property)
310 path = build_directory_name( 2, f->Property, NULL );
312 TRACE(" internally set to %s\n",debugstr_w(path));
314 MSI_SetPropertyW( package, name, path );
320 LPWSTR parent = f->Parent->Directory;
322 TRACE(" ! Parent is %s\n", debugstr_w(parent));
324 p = resolve_folder(package, parent, source, set_prop, NULL);
327 TRACE(" TargetDefault = %s\n", debugstr_w(f->TargetDefault));
329 path = build_directory_name( 3, p, f->TargetDefault, NULL );
330 f->ResolvedTarget = strdupW( path );
331 TRACE(" resolved into %s\n",debugstr_w(path));
333 MSI_SetPropertyW(package,name,path);
337 if (f->SourceDefault && f->SourceDefault[0]!='.')
338 path = build_directory_name( 3, p, f->SourceDefault, NULL );
341 TRACE(" (source)resolved into %s\n",debugstr_w(path));
342 f->ResolvedSource = strdupW( path );
344 HeapFree(GetProcessHeap(),0,p);
349 /* wrapper to resist a need for a full rewrite right now */
350 DWORD deformat_string(MSIPACKAGE *package, LPCWSTR ptr, WCHAR** data )
354 MSIRECORD *rec = MSI_CreateRecord(1);
357 MSI_RecordSetStringW(rec,0,ptr);
358 MSI_FormatRecordW(package,rec,NULL,&size);
362 *data = HeapAlloc(GetProcessHeap(),0,size*sizeof(WCHAR));
364 MSI_FormatRecordW(package,rec,*data,&size);
367 msiobj_release( &rec->hdr );
368 return sizeof(WCHAR)*size;
370 msiobj_release( &rec->hdr );
377 UINT schedule_action(MSIPACKAGE *package, UINT script, LPCWSTR action)
380 LPWSTR *newbuf = NULL;
381 if (script >= TOTAL_SCRIPTS)
383 FIXME("Unknown script requested %i\n",script);
384 return ERROR_FUNCTION_FAILED;
386 TRACE("Scheduling Action %s in script %i\n",debugstr_w(action), script);
388 count = package->script->ActionCount[script];
389 package->script->ActionCount[script]++;
391 newbuf = HeapReAlloc(GetProcessHeap(),0,
392 package->script->Actions[script],
393 package->script->ActionCount[script]* sizeof(LPWSTR));
395 newbuf = HeapAlloc(GetProcessHeap(),0, sizeof(LPWSTR));
397 newbuf[count] = strdupW(action);
398 package->script->Actions[script] = newbuf;
400 return ERROR_SUCCESS;
403 static void remove_tracked_tempfiles(MSIPACKAGE* package)
410 LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
414 TRACE("Cleaning up %s\n", debugstr_w( file->TargetPath ));
415 DeleteFileW( file->TargetPath );
420 static void free_feature( MSIFEATURE *feature )
422 struct list *item, *cursor;
424 LIST_FOR_EACH_SAFE( item, cursor, &feature->Components )
426 ComponentList *cl = LIST_ENTRY( item, ComponentList, entry );
427 list_remove( &cl->entry );
428 HeapFree( GetProcessHeap(), 0, cl );
430 HeapFree( GetProcessHeap(), 0, feature );
434 /* Called when the package is being closed */
435 void ACTION_free_package_structures( MSIPACKAGE* package)
438 struct list *item, *cursor;
440 TRACE("Freeing package action data\n");
442 remove_tracked_tempfiles(package);
444 LIST_FOR_EACH_SAFE( item, cursor, &package->features )
446 MSIFEATURE *feature = LIST_ENTRY( item, MSIFEATURE, entry );
447 list_remove( &feature->entry );
448 free_feature( feature );
451 LIST_FOR_EACH_SAFE( item, cursor, &package->folders )
453 MSIFOLDER *folder = LIST_ENTRY( item, MSIFOLDER, entry );
455 list_remove( &folder->entry );
456 HeapFree( GetProcessHeap(), 0, folder->Directory );
457 HeapFree( GetProcessHeap(), 0, folder->TargetDefault );
458 HeapFree( GetProcessHeap(), 0, folder->SourceDefault );
459 HeapFree( GetProcessHeap(), 0, folder->ResolvedTarget );
460 HeapFree( GetProcessHeap(), 0, folder->ResolvedSource );
461 HeapFree( GetProcessHeap(), 0, folder->Property );
464 LIST_FOR_EACH_SAFE( item, cursor, &package->components )
466 MSICOMPONENT *comp = LIST_ENTRY( item, MSICOMPONENT, entry );
468 list_remove( &comp->entry );
469 HeapFree( GetProcessHeap(), 0, comp->FullKeypath );
470 HeapFree( GetProcessHeap(), 0, comp );
473 LIST_FOR_EACH_SAFE( item, cursor, &package->files )
475 MSIFILE *file = LIST_ENTRY( item, MSIFILE, entry );
477 list_remove( &file->entry );
478 HeapFree( GetProcessHeap(), 0, file->File );
479 HeapFree( GetProcessHeap(), 0, file->FileName );
480 HeapFree( GetProcessHeap(), 0, file->ShortName );
481 HeapFree( GetProcessHeap(), 0, file->Version );
482 HeapFree( GetProcessHeap(), 0, file->Language );
483 HeapFree( GetProcessHeap(), 0, file->SourcePath );
484 HeapFree( GetProcessHeap(), 0, file->TargetPath );
485 HeapFree( GetProcessHeap(), 0, file );
488 /* clean up extension, progid, class and verb structures */
489 LIST_FOR_EACH_SAFE( item, cursor, &package->classes )
491 MSICLASS *cls = LIST_ENTRY( item, MSICLASS, entry );
493 list_remove( &cls->entry );
494 HeapFree( GetProcessHeap(), 0, cls->Description );
495 HeapFree( GetProcessHeap(), 0, cls->FileTypeMask );
496 HeapFree( GetProcessHeap(), 0, cls->IconPath );
497 HeapFree( GetProcessHeap(), 0, cls->DefInprocHandler );
498 HeapFree( GetProcessHeap(), 0, cls->DefInprocHandler32 );
499 HeapFree( GetProcessHeap(), 0, cls->Argument );
500 HeapFree( GetProcessHeap(), 0, cls->ProgIDText );
501 HeapFree( GetProcessHeap(), 0, cls );
504 LIST_FOR_EACH_SAFE( item, cursor, &package->extensions )
506 MSIEXTENSION *ext = LIST_ENTRY( item, MSIEXTENSION, entry );
508 list_remove( &ext->entry );
509 HeapFree( GetProcessHeap(), 0, ext->ProgIDText );
510 HeapFree( GetProcessHeap(), 0, ext );
513 for (i = 0; i < package->loaded_progids; i++)
515 HeapFree(GetProcessHeap(),0,package->progids[i].ProgID);
516 HeapFree(GetProcessHeap(),0,package->progids[i].Description);
517 HeapFree(GetProcessHeap(),0,package->progids[i].IconPath);
520 if (package->progids && package->loaded_progids > 0)
521 HeapFree(GetProcessHeap(),0,package->progids);
523 for (i = 0; i < package->loaded_verbs; i++)
525 HeapFree(GetProcessHeap(),0,package->verbs[i].Verb);
526 HeapFree(GetProcessHeap(),0,package->verbs[i].Command);
527 HeapFree(GetProcessHeap(),0,package->verbs[i].Argument);
530 if (package->verbs && package->loaded_verbs > 0)
531 HeapFree(GetProcessHeap(),0,package->verbs);
533 LIST_FOR_EACH_SAFE( item, cursor, &package->mimes )
535 MSIMIME *mt = LIST_ENTRY( item, MSIMIME, entry );
537 list_remove( &mt->entry );
538 HeapFree( GetProcessHeap(), 0, mt->ContentType );
539 HeapFree( GetProcessHeap(), 0, mt );
542 LIST_FOR_EACH_SAFE( item, cursor, &package->appids )
544 MSIAPPID *appid = LIST_ENTRY( item, MSIAPPID, entry );
546 list_remove( &appid->entry );
547 HeapFree( GetProcessHeap(), 0, appid->RemoteServerName );
548 HeapFree( GetProcessHeap(), 0, appid->LocalServer );
549 HeapFree( GetProcessHeap(), 0, appid->ServiceParameters );
550 HeapFree( GetProcessHeap(), 0, appid->DllSurrogate );
551 HeapFree( GetProcessHeap(), 0, appid );
556 for (i = 0; i < TOTAL_SCRIPTS; i++)
559 for (j = 0; j < package->script->ActionCount[i]; j++)
560 HeapFree(GetProcessHeap(),0,package->script->Actions[i][j]);
562 HeapFree(GetProcessHeap(),0,package->script->Actions[i]);
565 for (i = 0; i < package->script->UniqueActionsCount; i++)
566 HeapFree(GetProcessHeap(),0,package->script->UniqueActions[i]);
568 HeapFree(GetProcessHeap(),0,package->script->UniqueActions);
569 HeapFree(GetProcessHeap(),0,package->script);
572 HeapFree(GetProcessHeap(),0,package->PackagePath);
573 HeapFree(GetProcessHeap(),0,package->msiFilePath);
574 HeapFree(GetProcessHeap(),0,package->ProductCode);
576 /* cleanup control event subscriptions */
577 ControlEvent_CleanupSubscriptions(package);
581 * build_directory_name()
583 * This function is to save messing round with directory names
584 * It handles adding backslashes between path segments,
585 * and can add \ at the end of the directory name if told to.
587 * It takes a variable number of arguments.
588 * It always allocates a new string for the result, so make sure
589 * to free the return value when finished with it.
591 * The first arg is the number of path segments that follow.
592 * The arguments following count are a list of path segments.
593 * A path segment may be NULL.
595 * Path segments will be added with a \ separating them.
596 * A \ will not be added after the last segment, however if the
597 * last segment is NULL, then the last character will be a \
600 LPWSTR build_directory_name(DWORD count, ...)
607 for(i=0; i<count; i++)
609 LPCWSTR str = va_arg(va,LPCWSTR);
611 sz += strlenW(str) + 1;
615 dir = HeapAlloc(GetProcessHeap(), 0, sz*sizeof(WCHAR));
619 for(i=0; i<count; i++)
621 LPCWSTR str = va_arg(va,LPCWSTR);
625 if( ((i+1)!=count) && dir[strlenW(dir)-1]!='\\')
631 /***********************************************************************
634 * Recursively create all directories in the path.
636 * shamelessly stolen from setupapi/queue.c
638 BOOL create_full_pathW(const WCHAR *path)
644 new_path = HeapAlloc(GetProcessHeap(), 0, (strlenW(path) + 1) *
647 strcpyW(new_path, path);
649 while((len = strlenW(new_path)) && new_path[len - 1] == '\\')
650 new_path[len - 1] = 0;
652 while(!CreateDirectoryW(new_path, NULL))
655 DWORD last_error = GetLastError();
656 if(last_error == ERROR_ALREADY_EXISTS)
659 if(last_error != ERROR_PATH_NOT_FOUND)
665 if(!(slash = strrchrW(new_path, '\\')))
671 len = slash - new_path;
673 if(!create_full_pathW(new_path))
678 new_path[len] = '\\';
681 HeapFree(GetProcessHeap(), 0, new_path);
685 void ui_progress(MSIPACKAGE *package, int a, int b, int c, int d )
689 row = MSI_CreateRecord(4);
690 MSI_RecordSetInteger(row,1,a);
691 MSI_RecordSetInteger(row,2,b);
692 MSI_RecordSetInteger(row,3,c);
693 MSI_RecordSetInteger(row,4,d);
694 MSI_ProcessMessage(package, INSTALLMESSAGE_PROGRESS, row);
695 msiobj_release(&row->hdr);
697 msi_dialog_check_messages(NULL);
700 void ui_actiondata(MSIPACKAGE *package, LPCWSTR action, MSIRECORD * record)
702 static const WCHAR Query_t[] =
703 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
704 '`','A','c','t','i','o', 'n','T','e','x','t','`',' ',
705 'W','H','E','R','E',' ', '`','A','c','t','i','o','n','`',' ','=',
706 ' ','\'','%','s','\'',0};
710 static const WCHAR szActionData[] =
711 {'A','c','t','i','o','n','D','a','t','a',0};
713 if (!package->LastAction || strcmpW(package->LastAction,action))
715 row = MSI_QueryGetRecord(package->db, Query_t, action);
719 if (MSI_RecordIsNull(row,3))
721 msiobj_release(&row->hdr);
725 /* update the cached actionformat */
726 HeapFree(GetProcessHeap(),0,package->ActionFormat);
727 package->ActionFormat = load_dynamic_stringW(row,3);
729 HeapFree(GetProcessHeap(),0,package->LastAction);
730 package->LastAction = strdupW(action);
732 msiobj_release(&row->hdr);
735 MSI_RecordSetStringW(record,0,package->ActionFormat);
737 MSI_FormatRecordW(package,record,message,&size);
739 row = MSI_CreateRecord(1);
740 MSI_RecordSetStringW(row,1,message);
742 MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, row);
744 ControlEvent_FireSubscribedEvent(package,szActionData, row);
746 msiobj_release(&row->hdr);
749 BOOL ACTION_VerifyComponentForAction(MSIPACKAGE* package, MSICOMPONENT* comp,
752 if (comp->Installed == check)
755 if (comp->ActionRequest == check)
761 BOOL ACTION_VerifyFeatureForAction( MSIFEATURE* feature, INSTALLSTATE check )
763 if (feature->Installed == check)
766 if (feature->ActionRequest == check)
772 void reduce_to_longfilename(WCHAR* filename)
774 LPWSTR p = strchrW(filename,'|');
776 memmove(filename, p+1, (strlenW(p+1)+1)*sizeof(WCHAR));
779 void reduce_to_shortfilename(WCHAR* filename)
781 LPWSTR p = strchrW(filename,'|');
786 LPWSTR create_component_advertise_string(MSIPACKAGE* package,
787 MSICOMPONENT* component, LPCWSTR feature)
790 WCHAR productid_85[21];
791 WCHAR component_85[21];
793 * I have a fair bit of confusion as to when a < is used and when a > is
794 * used. I do not think i have it right...
796 * Ok it appears that the > is used if there is a guid for the compoenent
797 * and the < is used if not.
799 static WCHAR fmt1[] = {'%','s','%','s','<',0,0};
800 static WCHAR fmt2[] = {'%','s','%','s','>','%','s',0,0};
801 LPWSTR output = NULL;
804 memset(productid_85,0,sizeof(productid_85));
805 memset(component_85,0,sizeof(component_85));
807 CLSIDFromString(package->ProductCode, &clsid);
809 encode_base85_guid(&clsid,productid_85);
811 CLSIDFromString(component->ComponentId, &clsid);
812 encode_base85_guid(&clsid,component_85);
814 TRACE("Doing something with this... %s %s %s\n",
815 debugstr_w(productid_85), debugstr_w(feature),
816 debugstr_w(component_85));
818 sz = lstrlenW(productid_85) + lstrlenW(feature);
820 sz += lstrlenW(component_85);
825 output = HeapAlloc(GetProcessHeap(),0,sz);
829 sprintfW(output,fmt2,productid_85,feature,component_85);
831 sprintfW(output,fmt1,productid_85,feature);
836 /* update compoennt state based on a feature change */
837 void ACTION_UpdateComponentStates(MSIPACKAGE *package, LPCWSTR szFeature)
839 INSTALLSTATE newstate;
843 feature = get_loaded_feature(package,szFeature);
847 newstate = feature->ActionRequest;
849 LIST_FOR_EACH_ENTRY( cl, &feature->Components, ComponentList, entry )
851 MSICOMPONENT* component = cl->component;
853 TRACE("MODIFYING(%i): Component %s (Installed %i, Action %i, Request %i)\n",
854 newstate, debugstr_w(component->Component), component->Installed,
855 component->Action, component->ActionRequest);
857 if (!component->Enabled)
861 if (newstate == INSTALLSTATE_LOCAL)
863 component->ActionRequest = INSTALLSTATE_LOCAL;
864 component->Action = INSTALLSTATE_LOCAL;
868 ComponentList *clist;
871 component->ActionRequest = newstate;
872 component->Action = newstate;
874 /*if any other feature wants is local we need to set it local*/
875 LIST_FOR_EACH_ENTRY( f, &package->features, MSIFEATURE, entry )
877 if ( component->ActionRequest != INSTALLSTATE_LOCAL )
880 LIST_FOR_EACH_ENTRY( clist, &f->Components, ComponentList, entry )
882 if ( clist->component == component )
884 if (f->ActionRequest == INSTALLSTATE_LOCAL)
886 TRACE("Saved by %s\n", debugstr_w(f->Feature));
887 component->ActionRequest = INSTALLSTATE_LOCAL;
888 component->Action = INSTALLSTATE_LOCAL;
896 TRACE("Result (%i): Component %s (Installed %i, Action %i, Request %i)\n",
897 newstate, debugstr_w(component->Component), component->Installed,
898 component->Action, component->ActionRequest);
902 UINT register_unique_action(MSIPACKAGE *package, LPCWSTR action)
905 LPWSTR *newbuf = NULL;
907 if (!package || !package->script)
910 TRACE("Registering Action %s as having fun\n",debugstr_w(action));
912 count = package->script->UniqueActionsCount;
913 package->script->UniqueActionsCount++;
915 newbuf = HeapReAlloc(GetProcessHeap(),0,
916 package->script->UniqueActions,
917 package->script->UniqueActionsCount* sizeof(LPWSTR));
919 newbuf = HeapAlloc(GetProcessHeap(),0, sizeof(LPWSTR));
921 newbuf[count] = strdupW(action);
922 package->script->UniqueActions = newbuf;
924 return ERROR_SUCCESS;
927 BOOL check_unique_action(MSIPACKAGE *package, LPCWSTR action)
931 if (!package || !package->script)
934 for (i = 0; i < package->script->UniqueActionsCount; i++)
935 if (!strcmpW(package->script->UniqueActions[i],action))
941 WCHAR* generate_error_string(MSIPACKAGE *package, UINT error, DWORD count, ... )
943 static const WCHAR query[] = {'S','E','L','E','C','T',' ','`','M','e','s','s','a','g','e','`',' ','F','R','O','M',' ','`','E','r','r','o','r','`',' ','W','H','E','R','E',' ','`','E','r','r','o','r','`',' ','=',' ','%','i',0};
953 row = MSI_QueryGetRecord(package->db, query, error);
957 rec = MSI_CreateRecord(count+2);
959 str = MSI_RecordGetString(row,1);
960 MSI_RecordSetStringW(rec,0,str);
961 msiobj_release( &row->hdr );
962 MSI_RecordSetInteger(rec,1,error);
965 for (i = 0; i < count; i++)
967 str = va_arg(va,LPCWSTR);
968 MSI_RecordSetStringW(rec,(i+2),str);
972 MSI_FormatRecordW(package,rec,NULL,&size);
976 data = HeapAlloc(GetProcessHeap(),0,size*sizeof(WCHAR));
978 MSI_FormatRecordW(package,rec,data,&size);
981 msiobj_release( &rec->hdr );
985 msiobj_release( &rec->hdr );