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 szProductCode[]= {'P','r','o','d','u','c','t','C','o','d','e',0};
44 const WCHAR cszRootDrive[] = {'R','O','O','T','D','R','I','V','E',0};
45 const WCHAR cszbs[]={'\\',0};
47 DWORD build_version_dword(LPCWSTR version_string)
51 DWORD rc = 0x00000000;
54 ptr1 = version_string;
63 ptr1 = strchrW(ptr1,'.');
73 ptr1 = strchrW(ptr1,'.');
83 rc = MAKELONG(build,MAKEWORD(minor,major));
84 TRACE("%s -> 0x%lx\n",debugstr_w(version_string),rc);
88 UINT build_icon_path(MSIPACKAGE *package, LPCWSTR icon_name,
96 static const WCHAR szInstaller[] =
97 {'M','i','c','r','o','s','o','f','t','\\',
98 'I','n','s','t','a','l','l','e','r','\\',0};
99 static const WCHAR szFolder[] =
100 {'A','p','p','D','a','t','a','F','o','l','d','e','r',0};
102 ProductCode = load_dynamic_property(package,szProductCode,&rc);
106 SystemFolder = load_dynamic_property(package,szFolder,NULL);
108 dest = build_directory_name(3, SystemFolder, szInstaller, ProductCode);
110 create_full_pathW(dest);
112 *FilePath = build_directory_name(2, dest, icon_name);
114 HeapFree(GetProcessHeap(),0,SystemFolder);
115 HeapFree(GetProcessHeap(),0,ProductCode);
116 HeapFree(GetProcessHeap(),0,dest);
117 return ERROR_SUCCESS;
120 WCHAR *load_dynamic_stringW(MSIRECORD *row, INT index)
127 if (MSI_RecordIsNull(row,index))
130 rc = MSI_RecordGetStringW(row,index,NULL,&sz);
132 /* having an empty string is different than NULL */
135 ret = HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR));
141 ret = HeapAlloc(GetProcessHeap(),0,sz * sizeof (WCHAR));
142 rc = MSI_RecordGetStringW(row,index,ret,&sz);
143 if (rc!=ERROR_SUCCESS)
145 ERR("Unable to load dynamic string\n");
146 HeapFree(GetProcessHeap(), 0, ret);
152 LPWSTR load_dynamic_property(MSIPACKAGE *package, LPCWSTR prop, UINT* rc)
158 r = MSI_GetPropertyW(package, prop, NULL, &sz);
159 if (r != ERROR_SUCCESS && r != ERROR_MORE_DATA)
166 str = HeapAlloc(GetProcessHeap(),0,sz*sizeof(WCHAR));
167 r = MSI_GetPropertyW(package, prop, str, &sz);
168 if (r != ERROR_SUCCESS)
170 HeapFree(GetProcessHeap(),0,str);
178 int get_loaded_component(MSIPACKAGE* package, LPCWSTR Component )
183 for (i = 0; i < package->loaded_components; i++)
185 if (strcmpW(Component,package->components[i].Component)==0)
194 int get_loaded_feature(MSIPACKAGE* package, LPCWSTR Feature )
199 for (i = 0; i < package->loaded_features; i++)
201 if (strcmpW(Feature,package->features[i].Feature)==0)
210 int get_loaded_file(MSIPACKAGE* package, LPCWSTR file)
215 for (i = 0; i < package->loaded_files; i++)
217 if (strcmpW(file,package->files[i].File)==0)
226 int track_tempfile(MSIPACKAGE *package, LPCWSTR name, LPCWSTR path)
234 for (i=0; i < package->loaded_files; i++)
235 if (strcmpW(package->files[i].File,name)==0)
238 index = package->loaded_files;
239 package->loaded_files++;
240 if (package->loaded_files== 1)
241 package->files = HeapAlloc(GetProcessHeap(),0,sizeof(MSIFILE));
243 package->files = HeapReAlloc(GetProcessHeap(),0,
244 package->files , package->loaded_files * sizeof(MSIFILE));
246 memset(&package->files[index],0,sizeof(MSIFILE));
248 package->files[index].File = strdupW(name);
249 package->files[index].TargetPath = strdupW(path);
250 package->files[index].Temporary = TRUE;
252 TRACE("Tracking tempfile (%s)\n",debugstr_w(package->files[index].File));
257 LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
258 BOOL set_prop, MSIFOLDER **folder)
261 LPWSTR p, path = NULL;
263 TRACE("Working to resolve %s\n",debugstr_w(name));
268 /* special resolving for Target and Source root dir */
269 if (strcmpW(name,cszTargetDir)==0 || strcmpW(name,cszSourceDir)==0)
274 check_path = load_dynamic_property(package,cszTargetDir,NULL);
277 check_path = load_dynamic_property(package,cszRootDrive,NULL);
279 MSI_SetPropertyW(package,cszTargetDir,check_path);
282 /* correct misbuilt target dir */
283 path = build_directory_name(2, check_path, NULL);
284 if (strcmpiW(path,check_path)!=0)
285 MSI_SetPropertyW(package,cszTargetDir,path);
289 for (i = 0; i < package->loaded_folders; i++)
291 if (strcmpW(package->folders[i].Directory,name)==0)
294 *folder = &(package->folders[i]);
300 path = load_dynamic_property(package,cszSourceDir,NULL);
303 path = load_dynamic_property(package,cszDatabase,NULL);
306 p = strrchrW(path,'\\');
313 for (i = 0; i < package->loaded_folders; i++)
315 if (strcmpW(package->folders[i].Directory,name)==0)
318 *folder = &(package->folders[i]);
324 for (i = 0; i < package->loaded_folders; i++)
326 if (strcmpW(package->folders[i].Directory,name)==0)
330 if (i >= package->loaded_folders)
334 *folder = &(package->folders[i]);
336 if (!source && package->folders[i].ResolvedTarget)
338 path = strdupW(package->folders[i].ResolvedTarget);
339 TRACE(" already resolved to %s\n",debugstr_w(path));
342 else if (source && package->folders[i].ResolvedSource)
344 path = strdupW(package->folders[i].ResolvedSource);
345 TRACE(" (source)already resolved to %s\n",debugstr_w(path));
348 else if (!source && package->folders[i].Property)
350 path = build_directory_name(2, package->folders[i].Property, NULL);
352 TRACE(" internally set to %s\n",debugstr_w(path));
354 MSI_SetPropertyW(package,name,path);
358 if (package->folders[i].ParentIndex >= 0)
360 LPWSTR parent = package->folders[package->folders[i].ParentIndex].Directory;
362 TRACE(" ! Parent is %s\n", debugstr_w(parent));
364 p = resolve_folder(package, parent, source, set_prop, NULL);
367 TRACE(" TargetDefault = %s\n",
368 debugstr_w(package->folders[i].TargetDefault));
370 path = build_directory_name(3, p,
371 package->folders[i].TargetDefault, NULL);
372 package->folders[i].ResolvedTarget = strdupW(path);
373 TRACE(" resolved into %s\n",debugstr_w(path));
375 MSI_SetPropertyW(package,name,path);
379 if (package->folders[i].SourceDefault &&
380 package->folders[i].SourceDefault[0]!='.')
381 path = build_directory_name(3, p, package->folders[i].SourceDefault, NULL);
384 TRACE(" (source)resolved into %s\n",debugstr_w(path));
385 package->folders[i].ResolvedSource = strdupW(path);
387 HeapFree(GetProcessHeap(),0,p);
392 /* wrapper to resist a need for a full rewrite right now */
393 DWORD deformat_string(MSIPACKAGE *package, LPCWSTR ptr, WCHAR** data )
397 MSIRECORD *rec = MSI_CreateRecord(1);
400 MSI_RecordSetStringW(rec,0,ptr);
401 MSI_FormatRecordW(package,rec,NULL,&size);
405 *data = HeapAlloc(GetProcessHeap(),0,size*sizeof(WCHAR));
407 MSI_FormatRecordW(package,rec,*data,&size);
410 msiobj_release( &rec->hdr );
411 return sizeof(WCHAR)*size;
413 msiobj_release( &rec->hdr );
420 UINT schedule_action(MSIPACKAGE *package, UINT script, LPCWSTR action)
423 LPWSTR *newbuf = NULL;
424 if (script >= TOTAL_SCRIPTS)
426 FIXME("Unknown script requested %i\n",script);
427 return ERROR_FUNCTION_FAILED;
429 TRACE("Scheduling Action %s in script %i\n",debugstr_w(action), script);
431 count = package->script->ActionCount[script];
432 package->script->ActionCount[script]++;
434 newbuf = HeapReAlloc(GetProcessHeap(),0,
435 package->script->Actions[script],
436 package->script->ActionCount[script]* sizeof(LPWSTR));
438 newbuf = HeapAlloc(GetProcessHeap(),0, sizeof(LPWSTR));
440 newbuf[count] = strdupW(action);
441 package->script->Actions[script] = newbuf;
443 return ERROR_SUCCESS;
446 static void remove_tracked_tempfiles(MSIPACKAGE* package)
453 for (i = 0; i < package->loaded_files; i++)
455 if (package->files[i].Temporary)
457 TRACE("Cleaning up %s\n",debugstr_w(package->files[i].TargetPath));
458 DeleteFileW(package->files[i].TargetPath);
464 /* Called when the package is being closed */
465 void ACTION_free_package_structures( MSIPACKAGE* package)
469 TRACE("Freeing package action data\n");
471 remove_tracked_tempfiles(package);
473 /* No dynamic buffers in features */
474 if (package->features && package->loaded_features > 0)
475 HeapFree(GetProcessHeap(),0,package->features);
477 for (i = 0; i < package->loaded_folders; i++)
479 HeapFree(GetProcessHeap(),0,package->folders[i].Directory);
480 HeapFree(GetProcessHeap(),0,package->folders[i].TargetDefault);
481 HeapFree(GetProcessHeap(),0,package->folders[i].SourceDefault);
482 HeapFree(GetProcessHeap(),0,package->folders[i].ResolvedTarget);
483 HeapFree(GetProcessHeap(),0,package->folders[i].ResolvedSource);
484 HeapFree(GetProcessHeap(),0,package->folders[i].Property);
486 if (package->folders && package->loaded_folders > 0)
487 HeapFree(GetProcessHeap(),0,package->folders);
489 for (i = 0; i < package->loaded_components; i++)
490 HeapFree(GetProcessHeap(),0,package->components[i].FullKeypath);
492 if (package->components && package->loaded_components > 0)
493 HeapFree(GetProcessHeap(),0,package->components);
495 for (i = 0; i < package->loaded_files; i++)
497 HeapFree(GetProcessHeap(),0,package->files[i].File);
498 HeapFree(GetProcessHeap(),0,package->files[i].FileName);
499 HeapFree(GetProcessHeap(),0,package->files[i].ShortName);
500 HeapFree(GetProcessHeap(),0,package->files[i].Version);
501 HeapFree(GetProcessHeap(),0,package->files[i].Language);
502 HeapFree(GetProcessHeap(),0,package->files[i].SourcePath);
503 HeapFree(GetProcessHeap(),0,package->files[i].TargetPath);
506 if (package->files && package->loaded_files > 0)
507 HeapFree(GetProcessHeap(),0,package->files);
509 /* clean up extension, progid, class and verb structures */
510 for (i = 0; i < package->loaded_classes; i++)
512 HeapFree(GetProcessHeap(),0,package->classes[i].Description);
513 HeapFree(GetProcessHeap(),0,package->classes[i].FileTypeMask);
514 HeapFree(GetProcessHeap(),0,package->classes[i].IconPath);
515 HeapFree(GetProcessHeap(),0,package->classes[i].DefInprocHandler);
516 HeapFree(GetProcessHeap(),0,package->classes[i].DefInprocHandler32);
517 HeapFree(GetProcessHeap(),0,package->classes[i].Argument);
518 HeapFree(GetProcessHeap(),0,package->classes[i].ProgIDText);
521 if (package->classes && package->loaded_classes > 0)
522 HeapFree(GetProcessHeap(),0,package->classes);
524 for (i = 0; i < package->loaded_extensions; i++)
526 HeapFree(GetProcessHeap(),0,package->extensions[i].ProgIDText);
529 if (package->extensions && package->loaded_extensions > 0)
530 HeapFree(GetProcessHeap(),0,package->extensions);
532 for (i = 0; i < package->loaded_progids; i++)
534 HeapFree(GetProcessHeap(),0,package->progids[i].ProgID);
535 HeapFree(GetProcessHeap(),0,package->progids[i].Description);
536 HeapFree(GetProcessHeap(),0,package->progids[i].IconPath);
539 if (package->progids && package->loaded_progids > 0)
540 HeapFree(GetProcessHeap(),0,package->progids);
542 for (i = 0; i < package->loaded_verbs; i++)
544 HeapFree(GetProcessHeap(),0,package->verbs[i].Verb);
545 HeapFree(GetProcessHeap(),0,package->verbs[i].Command);
546 HeapFree(GetProcessHeap(),0,package->verbs[i].Argument);
549 if (package->verbs && package->loaded_verbs > 0)
550 HeapFree(GetProcessHeap(),0,package->verbs);
552 for (i = 0; i < package->loaded_mimes; i++)
553 HeapFree(GetProcessHeap(),0,package->mimes[i].ContentType);
555 if (package->mimes && package->loaded_mimes > 0)
556 HeapFree(GetProcessHeap(),0,package->mimes);
558 for (i = 0; i < package->loaded_appids; i++)
560 HeapFree(GetProcessHeap(),0,package->appids[i].RemoteServerName);
561 HeapFree(GetProcessHeap(),0,package->appids[i].LocalServer);
562 HeapFree(GetProcessHeap(),0,package->appids[i].ServiceParameters);
563 HeapFree(GetProcessHeap(),0,package->appids[i].DllSurrogate);
566 if (package->appids && package->loaded_appids > 0)
567 HeapFree(GetProcessHeap(),0,package->appids);
571 for (i = 0; i < TOTAL_SCRIPTS; i++)
574 for (j = 0; j < package->script->ActionCount[i]; j++)
575 HeapFree(GetProcessHeap(),0,package->script->Actions[i][j]);
577 HeapFree(GetProcessHeap(),0,package->script->Actions[i]);
580 for (i = 0; i < package->script->UniqueActionsCount; i++)
581 HeapFree(GetProcessHeap(),0,package->script->UniqueActions[i]);
583 HeapFree(GetProcessHeap(),0,package->script->UniqueActions);
584 HeapFree(GetProcessHeap(),0,package->script);
587 HeapFree(GetProcessHeap(),0,package->PackagePath);
588 HeapFree(GetProcessHeap(),0,package->msiFilePath);
590 /* cleanup control event subscriptions */
591 ControlEvent_CleanupSubscriptions(package);
595 * build_directory_name()
597 * This function is to save messing round with directory names
598 * It handles adding backslashes between path segments,
599 * and can add \ at the end of the directory name if told to.
601 * It takes a variable number of arguments.
602 * It always allocates a new string for the result, so make sure
603 * to free the return value when finished with it.
605 * The first arg is the number of path segments that follow.
606 * The arguments following count are a list of path segments.
607 * A path segment may be NULL.
609 * Path segments will be added with a \ separating them.
610 * A \ will not be added after the last segment, however if the
611 * last segment is NULL, then the last character will be a \
614 LPWSTR build_directory_name(DWORD count, ...)
621 for(i=0; i<count; i++)
623 LPCWSTR str = va_arg(va,LPCWSTR);
625 sz += strlenW(str) + 1;
629 dir = HeapAlloc(GetProcessHeap(), 0, sz*sizeof(WCHAR));
633 for(i=0; i<count; i++)
635 LPCWSTR str = va_arg(va,LPCWSTR);
639 if( ((i+1)!=count) && dir[strlenW(dir)-1]!='\\')
645 /***********************************************************************
648 * Recursively create all directories in the path.
650 * shamelessly stolen from setupapi/queue.c
652 BOOL create_full_pathW(const WCHAR *path)
658 new_path = HeapAlloc(GetProcessHeap(), 0, (strlenW(path) + 1) *
661 strcpyW(new_path, path);
663 while((len = strlenW(new_path)) && new_path[len - 1] == '\\')
664 new_path[len - 1] = 0;
666 while(!CreateDirectoryW(new_path, NULL))
669 DWORD last_error = GetLastError();
670 if(last_error == ERROR_ALREADY_EXISTS)
673 if(last_error != ERROR_PATH_NOT_FOUND)
679 if(!(slash = strrchrW(new_path, '\\')))
685 len = slash - new_path;
687 if(!create_full_pathW(new_path))
692 new_path[len] = '\\';
695 HeapFree(GetProcessHeap(), 0, new_path);
699 void ui_progress(MSIPACKAGE *package, int a, int b, int c, int d )
703 row = MSI_CreateRecord(4);
704 MSI_RecordSetInteger(row,1,a);
705 MSI_RecordSetInteger(row,2,b);
706 MSI_RecordSetInteger(row,3,c);
707 MSI_RecordSetInteger(row,4,d);
708 MSI_ProcessMessage(package, INSTALLMESSAGE_PROGRESS, row);
709 msiobj_release(&row->hdr);
711 msi_dialog_check_messages(NULL);
714 void ui_actiondata(MSIPACKAGE *package, LPCWSTR action, MSIRECORD * record)
716 static const WCHAR Query_t[] =
717 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
718 '`','A','c','t','i','o', 'n','T','e','x','t','`',' ',
719 'W','H','E','R','E',' ', '`','A','c','t','i','o','n','`',' ','=',
720 ' ','\'','%','s','\'',0};
724 static const WCHAR szActionData[] =
725 {'A','c','t','i','o','n','D','a','t','a',0};
727 if (!package->LastAction || strcmpW(package->LastAction,action))
729 row = MSI_QueryGetRecord(package->db, Query_t, action);
733 if (MSI_RecordIsNull(row,3))
735 msiobj_release(&row->hdr);
739 /* update the cached actionformat */
740 HeapFree(GetProcessHeap(),0,package->ActionFormat);
741 package->ActionFormat = load_dynamic_stringW(row,3);
743 HeapFree(GetProcessHeap(),0,package->LastAction);
744 package->LastAction = strdupW(action);
746 msiobj_release(&row->hdr);
749 MSI_RecordSetStringW(record,0,package->ActionFormat);
751 MSI_FormatRecordW(package,record,message,&size);
753 row = MSI_CreateRecord(1);
754 MSI_RecordSetStringW(row,1,message);
756 MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, row);
758 ControlEvent_FireSubscribedEvent(package,szActionData, row);
760 msiobj_release(&row->hdr);
763 BOOL ACTION_VerifyComponentForAction(MSIPACKAGE* package, INT index,
766 if (package->components[index].Installed == check)
769 if (package->components[index].ActionRequest == check)
775 BOOL ACTION_VerifyFeatureForAction(MSIPACKAGE* package, INT index,
778 if (package->features[index].Installed == check)
781 if (package->features[index].ActionRequest == check)
787 void reduce_to_longfilename(WCHAR* filename)
789 LPWSTR p = strchrW(filename,'|');
791 memmove(filename, p+1, (strlenW(p+1)+1)*sizeof(WCHAR));
794 void reduce_to_shortfilename(WCHAR* filename)
796 LPWSTR p = strchrW(filename,'|');
801 LPWSTR create_component_advertise_string(MSIPACKAGE* package,
802 MSICOMPONENT* component, LPCWSTR feature)
804 LPWSTR productid=NULL;
806 WCHAR productid_85[21];
807 WCHAR component_85[21];
809 * I have a fair bit of confusion as to when a < is used and when a > is
810 * used. I do not think i have it right...
812 * Ok it appears that the > is used if there is a guid for the compoenent
813 * and the < is used if not.
815 static WCHAR fmt1[] = {'%','s','%','s','<',0,0};
816 static WCHAR fmt2[] = {'%','s','%','s','>','%','s',0,0};
817 LPWSTR output = NULL;
820 memset(productid_85,0,sizeof(productid_85));
821 memset(component_85,0,sizeof(component_85));
823 productid = load_dynamic_property(package,szProductCode,NULL);
824 CLSIDFromString(productid, &clsid);
826 encode_base85_guid(&clsid,productid_85);
828 CLSIDFromString(component->ComponentId, &clsid);
829 encode_base85_guid(&clsid,component_85);
831 TRACE("Doing something with this... %s %s %s\n",
832 debugstr_w(productid_85), debugstr_w(feature),
833 debugstr_w(component_85));
835 sz = lstrlenW(productid_85) + lstrlenW(feature);
837 sz += lstrlenW(component_85);
842 output = HeapAlloc(GetProcessHeap(),0,sz);
846 sprintfW(output,fmt2,productid_85,feature,component_85);
848 sprintfW(output,fmt1,productid_85,feature);
850 HeapFree(GetProcessHeap(),0,productid);
855 /* update compoennt state based on a feature change */
856 void ACTION_UpdateComponentStates(MSIPACKAGE *package, LPCWSTR szFeature)
859 INSTALLSTATE newstate;
862 i = get_loaded_feature(package,szFeature);
866 feature = &package->features[i];
867 newstate = feature->ActionRequest;
869 for( i = 0; i < feature->ComponentCount; i++)
871 MSICOMPONENT* component = &package->components[feature->Components[i]];
873 TRACE("MODIFYING(%i): Component %s (Installed %i, Action %i, Request %i)\n",
874 newstate, debugstr_w(component->Component), component->Installed,
875 component->Action, component->ActionRequest);
877 if (!component->Enabled)
881 if (newstate == INSTALLSTATE_LOCAL)
883 component->ActionRequest = INSTALLSTATE_LOCAL;
884 component->Action = INSTALLSTATE_LOCAL;
890 component->ActionRequest = newstate;
891 component->Action = newstate;
893 /*if any other feature wants is local we need to set it local*/
895 j < package->loaded_features &&
896 component->ActionRequest != INSTALLSTATE_LOCAL;
899 for (k = 0; k < package->features[j].ComponentCount; k++)
900 if ( package->features[j].Components[k] ==
901 feature->Components[i] )
903 if (package->features[j].ActionRequest ==
906 TRACE("Saved by %s\n", debugstr_w(package->features[j].Feature));
907 component->ActionRequest = INSTALLSTATE_LOCAL;
908 component->Action = INSTALLSTATE_LOCAL;
915 TRACE("Result (%i): Component %s (Installed %i, Action %i, Request %i)\n",
916 newstate, debugstr_w(component->Component), component->Installed,
917 component->Action, component->ActionRequest);
921 UINT register_unique_action(MSIPACKAGE *package, LPCWSTR action)
924 LPWSTR *newbuf = NULL;
926 if (!package || !package->script)
929 TRACE("Registering Action %s as having fun\n",debugstr_w(action));
931 count = package->script->UniqueActionsCount;
932 package->script->UniqueActionsCount++;
934 newbuf = HeapReAlloc(GetProcessHeap(),0,
935 package->script->UniqueActions,
936 package->script->UniqueActionsCount* sizeof(LPWSTR));
938 newbuf = HeapAlloc(GetProcessHeap(),0, sizeof(LPWSTR));
940 newbuf[count] = strdupW(action);
941 package->script->UniqueActions = newbuf;
943 return ERROR_SUCCESS;
946 BOOL check_unique_action(MSIPACKAGE *package, LPCWSTR action)
950 if (!package || !package->script)
953 for (i = 0; i < package->script->UniqueActionsCount; i++)
954 if (!strcmpW(package->script->UniqueActions[i],action))
960 WCHAR* generate_error_string(MSIPACKAGE *package, UINT error, DWORD count, ... )
962 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};
972 row = MSI_QueryGetRecord(package->db, query, error);
976 rec = MSI_CreateRecord(count+2);
978 str = MSI_RecordGetString(row,1);
979 MSI_RecordSetStringW(rec,0,str);
980 msiobj_release( &row->hdr );
981 MSI_RecordSetInteger(rec,1,error);
984 for (i = 0; i < count; i++)
986 str = va_arg(va,LPCWSTR);
987 MSI_RecordSetStringW(rec,(i+2),str);
991 MSI_FormatRecordW(package,rec,NULL,&size);
995 data = HeapAlloc(GetProcessHeap(),0,size*sizeof(WCHAR));
997 MSI_FormatRecordW(package,rec,data,&size);
1000 msiobj_release( &rec->hdr );
1004 msiobj_release( &rec->hdr );