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 LPWSTR build_icon_path(MSIPACKAGE *package, LPCWSTR icon_name )
89 LPWSTR SystemFolder, dest, FilePath;
91 static const WCHAR szInstaller[] =
92 {'M','i','c','r','o','s','o','f','t','\\',
93 'I','n','s','t','a','l','l','e','r','\\',0};
94 static const WCHAR szFolder[] =
95 {'A','p','p','D','a','t','a','F','o','l','d','e','r',0};
97 SystemFolder = msi_dup_property( package, szFolder );
99 dest = build_directory_name(3, SystemFolder, szInstaller, package->ProductCode);
101 create_full_pathW(dest);
103 FilePath = build_directory_name(2, dest, icon_name);
105 msi_free(SystemFolder);
110 LPWSTR msi_dup_record_field( MSIRECORD *row, INT index )
112 return strdupW( MSI_RecordGetString(row,index) );
115 LPWSTR msi_dup_property(MSIPACKAGE *package, LPCWSTR prop)
121 r = MSI_GetPropertyW(package, prop, NULL, &sz);
122 if (r != ERROR_SUCCESS && r != ERROR_MORE_DATA)
126 str = msi_alloc(sz*sizeof(WCHAR));
127 r = MSI_GetPropertyW(package, prop, str, &sz);
128 if (r != ERROR_SUCCESS)
136 MSICOMPONENT* get_loaded_component( MSIPACKAGE* package, LPCWSTR Component )
140 LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry )
142 if (lstrcmpW(Component,comp->Component)==0)
148 MSIFEATURE* get_loaded_feature(MSIPACKAGE* package, LPCWSTR Feature )
152 LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
154 if (lstrcmpW( Feature, feature->Feature )==0)
160 MSIFILE* get_loaded_file( MSIPACKAGE* package, LPCWSTR key )
164 LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
166 if (lstrcmpW( key, file->File )==0)
172 int track_tempfile( MSIPACKAGE *package, LPCWSTR name, LPCWSTR path )
176 LIST_FOR_EACH_ENTRY( temp, &package->tempfiles, MSITEMPFILE, entry )
178 if (lstrcmpW( name, temp->File )==0)
180 TRACE("tempfile %s already exists with path %s\n",
181 debugstr_w(temp->File), debugstr_w(temp->Path));
186 temp = msi_alloc_zero( sizeof (MSITEMPFILE) );
190 list_add_head( &package->tempfiles, &temp->entry );
192 temp->File = strdupW( name );
193 temp->Path = strdupW( path );
195 TRACE("adding tempfile %s with path %s\n",
196 debugstr_w(temp->File), debugstr_w(temp->Path));
201 MSIFOLDER *get_loaded_folder( MSIPACKAGE *package, LPCWSTR dir )
205 LIST_FOR_EACH_ENTRY( folder, &package->folders, MSIFOLDER, entry )
207 if (lstrcmpW( dir, folder->Directory )==0)
213 static LPWSTR get_source_root( MSIPACKAGE *package )
217 path = msi_dup_property( package, cszSourceDir );
221 path = msi_dup_property( package, cszDatabase );
224 p = strrchrW(path,'\\');
232 * clean_spaces_from_path()
234 * removes spaces from the beginning and end of path segments
235 * removes multiple \\ characters
237 static void clean_spaces_from_path( LPWSTR p )
244 /* copy until the end of the string or a space */
245 while (*p != ' ' && (*q = *p))
248 /* reduce many backslashes to one */
249 if (*p != '\\' || *q != '\\')
253 /* quit at the end of the string */
257 /* count the number of spaces */
262 /* if it's leading or trailing space, skip it */
263 if ( len == 0 || p[-1] == '\\' || p[n] == '\\' )
265 else /* copy n spaces */
266 while (n && (*q++ = *p++)) n--;
270 LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
271 BOOL set_prop, MSIFOLDER **folder)
274 LPWSTR p, path = NULL;
276 TRACE("Working to resolve %s\n",debugstr_w(name));
281 /* special resolving for Target and Source root dir */
282 if (strcmpW(name,cszTargetDir)==0 || strcmpW(name,cszSourceDir)==0)
287 check_path = msi_dup_property( package, cszTargetDir );
290 check_path = msi_dup_property( package, cszRootDrive );
292 MSI_SetPropertyW(package,cszTargetDir,check_path);
295 /* correct misbuilt target dir */
296 path = build_directory_name(2, check_path, NULL);
297 clean_spaces_from_path( path );
298 if (strcmpiW(path,check_path)!=0)
299 MSI_SetPropertyW(package,cszTargetDir,path);
300 msi_free(check_path);
303 path = get_source_root( package );
305 *folder = get_loaded_folder( package, name );
309 f = get_loaded_folder( package, name );
316 if (!source && f->ResolvedTarget)
318 path = strdupW( f->ResolvedTarget );
319 TRACE(" already resolved to %s\n",debugstr_w(path));
322 else if (source && f->ResolvedSource)
324 path = strdupW( f->ResolvedSource );
325 TRACE(" (source)already resolved to %s\n",debugstr_w(path));
328 else if (!source && f->Property)
330 path = build_directory_name( 2, f->Property, NULL );
332 TRACE(" internally set to %s\n",debugstr_w(path));
334 MSI_SetPropertyW( package, name, path );
340 LPWSTR parent = f->Parent->Directory;
342 TRACE(" ! Parent is %s\n", debugstr_w(parent));
344 p = resolve_folder(package, parent, source, set_prop, NULL);
347 TRACE(" TargetDefault = %s\n", debugstr_w(f->TargetDefault));
349 path = build_directory_name( 3, p, f->TargetDefault, NULL );
350 clean_spaces_from_path( path );
351 f->ResolvedTarget = strdupW( path );
352 TRACE("target -> %s\n", debugstr_w(path));
354 MSI_SetPropertyW(package,name,path);
358 /* source may be in a few different places ... check each of them */
361 /* try the long path directory */
362 if (f->SourceLongPath)
364 path = build_directory_name( 3, p, f->SourceLongPath, NULL );
365 if (INVALID_FILE_ATTRIBUTES == GetFileAttributesW( path ))
372 /* try the short path directory */
373 if (!path && f->SourceShortPath)
375 path = build_directory_name( 3, p, f->SourceShortPath, NULL );
376 if (INVALID_FILE_ATTRIBUTES == GetFileAttributesW( path ))
383 /* try the parent folder's path */
387 if (INVALID_FILE_ATTRIBUTES == GetFileAttributesW( path ))
394 /* try the root of the install */
396 path = get_source_root( package );
398 TRACE("source -> %s\n", debugstr_w(path));
399 f->ResolvedSource = strdupW( path );
406 /* wrapper to resist a need for a full rewrite right now */
407 DWORD deformat_string(MSIPACKAGE *package, LPCWSTR ptr, WCHAR** data )
411 MSIRECORD *rec = MSI_CreateRecord(1);
414 MSI_RecordSetStringW(rec,0,ptr);
415 MSI_FormatRecordW(package,rec,NULL,&size);
419 *data = msi_alloc(size*sizeof(WCHAR));
421 MSI_FormatRecordW(package,rec,*data,&size);
424 msiobj_release( &rec->hdr );
425 return sizeof(WCHAR)*size;
427 msiobj_release( &rec->hdr );
434 UINT schedule_action(MSIPACKAGE *package, UINT script, LPCWSTR action)
437 LPWSTR *newbuf = NULL;
438 if (script >= TOTAL_SCRIPTS)
440 FIXME("Unknown script requested %i\n",script);
441 return ERROR_FUNCTION_FAILED;
443 TRACE("Scheduling Action %s in script %i\n",debugstr_w(action), script);
445 count = package->script->ActionCount[script];
446 package->script->ActionCount[script]++;
448 newbuf = msi_realloc( package->script->Actions[script],
449 package->script->ActionCount[script]* sizeof(LPWSTR));
451 newbuf = msi_alloc( sizeof(LPWSTR));
453 newbuf[count] = strdupW(action);
454 package->script->Actions[script] = newbuf;
456 return ERROR_SUCCESS;
459 static void remove_tracked_tempfiles(MSIPACKAGE* package)
461 struct list *item, *cursor;
463 LIST_FOR_EACH_SAFE( item, cursor, &package->tempfiles )
465 MSITEMPFILE *temp = LIST_ENTRY( item, MSITEMPFILE, entry );
467 list_remove( &temp->entry );
468 TRACE("deleting temp file %s\n", debugstr_w( temp->Path ));
469 DeleteFileW( temp->Path );
470 msi_free( temp->File );
471 msi_free( temp->Path );
476 static void free_feature( MSIFEATURE *feature )
478 struct list *item, *cursor;
480 LIST_FOR_EACH_SAFE( item, cursor, &feature->Components )
482 ComponentList *cl = LIST_ENTRY( item, ComponentList, entry );
483 list_remove( &cl->entry );
486 msi_free( feature->Feature );
487 msi_free( feature->Feature_Parent );
488 msi_free( feature->Directory );
489 msi_free( feature->Description );
490 msi_free( feature->Title );
494 void free_extension( MSIEXTENSION *ext )
496 struct list *item, *cursor;
498 LIST_FOR_EACH_SAFE( item, cursor, &ext->verbs )
500 MSIVERB *verb = LIST_ENTRY( item, MSIVERB, entry );
502 list_remove( &verb->entry );
503 msi_free( verb->Verb );
504 msi_free( verb->Command );
505 msi_free( verb->Argument );
509 msi_free( ext->Extension );
510 msi_free( ext->ProgIDText );
514 /* Called when the package is being closed */
515 void ACTION_free_package_structures( MSIPACKAGE* package)
518 struct list *item, *cursor;
520 TRACE("Freeing package action data\n");
522 remove_tracked_tempfiles(package);
524 LIST_FOR_EACH_SAFE( item, cursor, &package->features )
526 MSIFEATURE *feature = LIST_ENTRY( item, MSIFEATURE, entry );
527 list_remove( &feature->entry );
528 free_feature( feature );
531 LIST_FOR_EACH_SAFE( item, cursor, &package->folders )
533 MSIFOLDER *folder = LIST_ENTRY( item, MSIFOLDER, entry );
535 list_remove( &folder->entry );
536 msi_free( folder->Directory );
537 msi_free( folder->TargetDefault );
538 msi_free( folder->SourceLongPath );
539 msi_free( folder->SourceShortPath );
540 msi_free( folder->ResolvedTarget );
541 msi_free( folder->ResolvedSource );
542 msi_free( folder->Property );
546 LIST_FOR_EACH_SAFE( item, cursor, &package->components )
548 MSICOMPONENT *comp = LIST_ENTRY( item, MSICOMPONENT, entry );
550 list_remove( &comp->entry );
551 msi_free( comp->Component );
552 msi_free( comp->ComponentId );
553 msi_free( comp->Directory );
554 msi_free( comp->Condition );
555 msi_free( comp->KeyPath );
556 msi_free( comp->FullKeypath );
560 LIST_FOR_EACH_SAFE( item, cursor, &package->files )
562 MSIFILE *file = LIST_ENTRY( item, MSIFILE, entry );
564 list_remove( &file->entry );
565 msi_free( file->File );
566 msi_free( file->FileName );
567 msi_free( file->ShortName );
568 msi_free( file->LongName );
569 msi_free( file->Version );
570 msi_free( file->Language );
571 msi_free( file->SourcePath );
572 msi_free( file->TargetPath );
576 /* clean up extension, progid, class and verb structures */
577 LIST_FOR_EACH_SAFE( item, cursor, &package->classes )
579 MSICLASS *cls = LIST_ENTRY( item, MSICLASS, entry );
581 list_remove( &cls->entry );
582 msi_free( cls->clsid );
583 msi_free( cls->Context );
584 msi_free( cls->Description );
585 msi_free( cls->FileTypeMask );
586 msi_free( cls->IconPath );
587 msi_free( cls->DefInprocHandler );
588 msi_free( cls->DefInprocHandler32 );
589 msi_free( cls->Argument );
590 msi_free( cls->ProgIDText );
594 LIST_FOR_EACH_SAFE( item, cursor, &package->extensions )
596 MSIEXTENSION *ext = LIST_ENTRY( item, MSIEXTENSION, entry );
598 list_remove( &ext->entry );
599 free_extension( ext );
602 LIST_FOR_EACH_SAFE( item, cursor, &package->progids )
604 MSIPROGID *progid = LIST_ENTRY( item, MSIPROGID, entry );
606 list_remove( &progid->entry );
607 msi_free( progid->ProgID );
608 msi_free( progid->Description );
609 msi_free( progid->IconPath );
613 LIST_FOR_EACH_SAFE( item, cursor, &package->mimes )
615 MSIMIME *mt = LIST_ENTRY( item, MSIMIME, entry );
617 list_remove( &mt->entry );
618 msi_free( mt->clsid );
619 msi_free( mt->ContentType );
623 LIST_FOR_EACH_SAFE( item, cursor, &package->appids )
625 MSIAPPID *appid = LIST_ENTRY( item, MSIAPPID, entry );
627 list_remove( &appid->entry );
628 msi_free( appid->AppID );
629 msi_free( appid->RemoteServerName );
630 msi_free( appid->LocalServer );
631 msi_free( appid->ServiceParameters );
632 msi_free( appid->DllSurrogate );
638 for (i = 0; i < TOTAL_SCRIPTS; i++)
641 for (j = 0; j < package->script->ActionCount[i]; j++)
642 msi_free(package->script->Actions[i][j]);
644 msi_free(package->script->Actions[i]);
647 for (i = 0; i < package->script->UniqueActionsCount; i++)
648 msi_free(package->script->UniqueActions[i]);
650 msi_free(package->script->UniqueActions);
651 msi_free(package->script);
654 msi_free(package->PackagePath);
655 msi_free(package->ProductCode);
656 msi_free(package->ActionFormat);
657 msi_free(package->LastAction);
659 /* cleanup control event subscriptions */
660 ControlEvent_CleanupSubscriptions(package);
664 * build_directory_name()
666 * This function is to save messing round with directory names
667 * It handles adding backslashes between path segments,
668 * and can add \ at the end of the directory name if told to.
670 * It takes a variable number of arguments.
671 * It always allocates a new string for the result, so make sure
672 * to free the return value when finished with it.
674 * The first arg is the number of path segments that follow.
675 * The arguments following count are a list of path segments.
676 * A path segment may be NULL.
678 * Path segments will be added with a \ separating them.
679 * A \ will not be added after the last segment, however if the
680 * last segment is NULL, then the last character will be a \
683 LPWSTR build_directory_name(DWORD count, ...)
690 for(i=0; i<count; i++)
692 LPCWSTR str = va_arg(va,LPCWSTR);
694 sz += strlenW(str) + 1;
698 dir = msi_alloc(sz*sizeof(WCHAR));
702 for(i=0; i<count; i++)
704 LPCWSTR str = va_arg(va,LPCWSTR);
708 if( ((i+1)!=count) && dir[strlenW(dir)-1]!='\\')
714 /***********************************************************************
717 * Recursively create all directories in the path.
719 * shamelessly stolen from setupapi/queue.c
721 BOOL create_full_pathW(const WCHAR *path)
727 new_path = msi_alloc( (strlenW(path) + 1) * sizeof(WCHAR));
729 strcpyW(new_path, path);
731 while((len = strlenW(new_path)) && new_path[len - 1] == '\\')
732 new_path[len - 1] = 0;
734 while(!CreateDirectoryW(new_path, NULL))
737 DWORD last_error = GetLastError();
738 if(last_error == ERROR_ALREADY_EXISTS)
741 if(last_error != ERROR_PATH_NOT_FOUND)
747 if(!(slash = strrchrW(new_path, '\\')))
753 len = slash - new_path;
755 if(!create_full_pathW(new_path))
760 new_path[len] = '\\';
767 void ui_progress(MSIPACKAGE *package, int a, int b, int c, int d )
771 row = MSI_CreateRecord(4);
772 MSI_RecordSetInteger(row,1,a);
773 MSI_RecordSetInteger(row,2,b);
774 MSI_RecordSetInteger(row,3,c);
775 MSI_RecordSetInteger(row,4,d);
776 MSI_ProcessMessage(package, INSTALLMESSAGE_PROGRESS, row);
777 msiobj_release(&row->hdr);
779 msi_dialog_check_messages(NULL);
782 void ui_actiondata(MSIPACKAGE *package, LPCWSTR action, MSIRECORD * record)
784 static const WCHAR Query_t[] =
785 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
786 '`','A','c','t','i','o', 'n','T','e','x','t','`',' ',
787 'W','H','E','R','E',' ', '`','A','c','t','i','o','n','`',' ','=',
788 ' ','\'','%','s','\'',0};
793 if (!package->LastAction || strcmpW(package->LastAction,action))
795 row = MSI_QueryGetRecord(package->db, Query_t, action);
799 if (MSI_RecordIsNull(row,3))
801 msiobj_release(&row->hdr);
805 /* update the cached actionformat */
806 msi_free(package->ActionFormat);
807 package->ActionFormat = msi_dup_record_field(row,3);
809 msi_free(package->LastAction);
810 package->LastAction = strdupW(action);
812 msiobj_release(&row->hdr);
815 MSI_RecordSetStringW(record,0,package->ActionFormat);
817 MSI_FormatRecordW(package,record,message,&size);
819 row = MSI_CreateRecord(1);
820 MSI_RecordSetStringW(row,1,message);
822 MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, row);
824 msiobj_release(&row->hdr);
827 BOOL ACTION_VerifyComponentForAction( MSICOMPONENT* comp, INSTALLSTATE check )
832 if (comp->Installed == check)
835 if (comp->ActionRequest == check)
841 BOOL ACTION_VerifyFeatureForAction( MSIFEATURE* feature, INSTALLSTATE check )
846 if (feature->Installed == check)
849 if (feature->ActionRequest == check)
855 void reduce_to_longfilename(WCHAR* filename)
857 LPWSTR p = strchrW(filename,'|');
859 memmove(filename, p+1, (strlenW(p+1)+1)*sizeof(WCHAR));
862 void reduce_to_shortfilename(WCHAR* filename)
864 LPWSTR p = strchrW(filename,'|');
869 LPWSTR create_component_advertise_string(MSIPACKAGE* package,
870 MSICOMPONENT* component, LPCWSTR feature)
873 WCHAR productid_85[21];
874 WCHAR component_85[21];
876 * I have a fair bit of confusion as to when a < is used and when a > is
877 * used. I do not think i have it right...
879 * Ok it appears that the > is used if there is a guid for the compoenent
880 * and the < is used if not.
882 static const WCHAR fmt1[] = {'%','s','%','s','<',0,0};
883 static const WCHAR fmt2[] = {'%','s','%','s','>','%','s',0,0};
884 LPWSTR output = NULL;
887 memset(productid_85,0,sizeof(productid_85));
888 memset(component_85,0,sizeof(component_85));
890 CLSIDFromString(package->ProductCode, &clsid);
892 encode_base85_guid(&clsid,productid_85);
894 CLSIDFromString(component->ComponentId, &clsid);
895 encode_base85_guid(&clsid,component_85);
897 TRACE("Doing something with this... %s %s %s\n",
898 debugstr_w(productid_85), debugstr_w(feature),
899 debugstr_w(component_85));
901 sz = lstrlenW(productid_85) + lstrlenW(feature);
903 sz += lstrlenW(component_85);
908 output = msi_alloc(sz);
912 sprintfW(output,fmt2,productid_85,feature,component_85);
914 sprintfW(output,fmt1,productid_85,feature);
919 /* update compoennt state based on a feature change */
920 void ACTION_UpdateComponentStates(MSIPACKAGE *package, LPCWSTR szFeature)
922 INSTALLSTATE newstate;
926 feature = get_loaded_feature(package,szFeature);
930 newstate = feature->ActionRequest;
932 LIST_FOR_EACH_ENTRY( cl, &feature->Components, ComponentList, entry )
934 MSICOMPONENT* component = cl->component;
936 TRACE("MODIFYING(%i): Component %s (Installed %i, Action %i, Request %i)\n",
937 newstate, debugstr_w(component->Component), component->Installed,
938 component->Action, component->ActionRequest);
940 if (!component->Enabled)
943 if (newstate == INSTALLSTATE_LOCAL)
945 component->ActionRequest = INSTALLSTATE_LOCAL;
946 component->Action = INSTALLSTATE_LOCAL;
950 ComponentList *clist;
953 component->ActionRequest = newstate;
954 component->Action = newstate;
956 /*if any other feature wants is local we need to set it local*/
957 LIST_FOR_EACH_ENTRY( f, &package->features, MSIFEATURE, entry )
959 if ( component->ActionRequest != INSTALLSTATE_LOCAL )
962 LIST_FOR_EACH_ENTRY( clist, &f->Components, ComponentList, entry )
964 if ( clist->component == component )
966 if (f->ActionRequest == INSTALLSTATE_LOCAL)
968 TRACE("Saved by %s\n", debugstr_w(f->Feature));
969 component->ActionRequest = INSTALLSTATE_LOCAL;
970 component->Action = INSTALLSTATE_LOCAL;
977 TRACE("Result (%i): Component %s (Installed %i, Action %i, Request %i)\n",
978 newstate, debugstr_w(component->Component), component->Installed,
979 component->Action, component->ActionRequest);
983 UINT register_unique_action(MSIPACKAGE *package, LPCWSTR action)
986 LPWSTR *newbuf = NULL;
988 if (!package->script)
991 TRACE("Registering Action %s as having fun\n",debugstr_w(action));
993 count = package->script->UniqueActionsCount;
994 package->script->UniqueActionsCount++;
996 newbuf = msi_realloc( package->script->UniqueActions,
997 package->script->UniqueActionsCount* sizeof(LPWSTR));
999 newbuf = msi_alloc( sizeof(LPWSTR));
1001 newbuf[count] = strdupW(action);
1002 package->script->UniqueActions = newbuf;
1004 return ERROR_SUCCESS;
1007 BOOL check_unique_action(MSIPACKAGE *package, LPCWSTR action)
1011 if (!package->script)
1014 for (i = 0; i < package->script->UniqueActionsCount; i++)
1015 if (!strcmpW(package->script->UniqueActions[i],action))
1021 WCHAR* generate_error_string(MSIPACKAGE *package, UINT error, DWORD count, ... )
1023 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};
1033 row = MSI_QueryGetRecord(package->db, query, error);
1037 rec = MSI_CreateRecord(count+2);
1039 str = MSI_RecordGetString(row,1);
1040 MSI_RecordSetStringW(rec,0,str);
1041 msiobj_release( &row->hdr );
1042 MSI_RecordSetInteger(rec,1,error);
1045 for (i = 0; i < count; i++)
1047 str = va_arg(va,LPCWSTR);
1048 MSI_RecordSetStringW(rec,(i+2),str);
1052 MSI_FormatRecordW(package,rec,NULL,&size);
1056 data = msi_alloc(size*sizeof(WCHAR));
1058 MSI_FormatRecordW(package,rec,data,&size);
1061 msiobj_release( &rec->hdr );
1065 msiobj_release( &rec->hdr );