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 LPWSTR
resolve_folder(MSIPACKAGE
*package
, LPCWSTR name
, BOOL source
,
214 BOOL set_prop
, MSIFOLDER
**folder
)
217 LPWSTR p
, path
= NULL
;
219 TRACE("Working to resolve %s\n",debugstr_w(name
));
224 /* source directories appear to always be at the root */
227 path
= msi_dup_property( package
, cszSourceDir
);
230 path
= msi_dup_property( package
, cszDatabase
);
233 p
= strrchrW(path
,'\\');
239 *folder
= get_loaded_folder( package
, name
);
243 /* special resolving for Target and Source root dir */
244 if (strcmpW(name
,cszTargetDir
)==0 || strcmpW(name
,cszSourceDir
)==0)
247 check_path
= msi_dup_property( package
, cszTargetDir
);
250 check_path
= msi_dup_property( package
, cszRootDrive
);
252 MSI_SetPropertyW(package
,cszTargetDir
,check_path
);
255 /* correct misbuilt target dir */
256 path
= build_directory_name(2, check_path
, NULL
);
257 if (strcmpiW(path
,check_path
)!=0)
258 MSI_SetPropertyW(package
,cszTargetDir
,path
);
259 msi_free(check_path
);
261 *folder
= get_loaded_folder( package
, name
);
265 f
= get_loaded_folder( package
, name
);
272 if (f
->ResolvedTarget
)
274 path
= strdupW( f
->ResolvedTarget
);
275 TRACE(" already resolved to %s\n",debugstr_w(path
));
278 else if (f
->Property
)
280 path
= build_directory_name( 2, f
->Property
, NULL
);
282 TRACE(" internally set to %s\n",debugstr_w(path
));
284 MSI_SetPropertyW( package
, name
, path
);
290 LPWSTR parent
= f
->Parent
->Directory
;
292 TRACE(" ! Parent is %s\n", debugstr_w(parent
));
294 p
= resolve_folder(package
, parent
, source
, set_prop
, NULL
);
295 TRACE(" TargetDefault = %s\n", debugstr_w(f
->TargetDefault
));
297 path
= build_directory_name( 3, p
, f
->TargetDefault
, NULL
);
298 f
->ResolvedTarget
= strdupW( path
);
299 TRACE(" resolved into %s\n",debugstr_w(path
));
301 MSI_SetPropertyW(package
,name
,path
);
307 /* wrapper to resist a need for a full rewrite right now */
308 DWORD
deformat_string(MSIPACKAGE
*package
, LPCWSTR ptr
, WCHAR
** data
)
312 MSIRECORD
*rec
= MSI_CreateRecord(1);
315 MSI_RecordSetStringW(rec
,0,ptr
);
316 MSI_FormatRecordW(package
,rec
,NULL
,&size
);
320 *data
= msi_alloc(size
*sizeof(WCHAR
));
322 MSI_FormatRecordW(package
,rec
,*data
,&size
);
325 msiobj_release( &rec
->hdr
);
326 return sizeof(WCHAR
)*size
;
328 msiobj_release( &rec
->hdr
);
335 UINT
schedule_action(MSIPACKAGE
*package
, UINT script
, LPCWSTR action
)
338 LPWSTR
*newbuf
= NULL
;
339 if (script
>= TOTAL_SCRIPTS
)
341 FIXME("Unknown script requested %i\n",script
);
342 return ERROR_FUNCTION_FAILED
;
344 TRACE("Scheduling Action %s in script %i\n",debugstr_w(action
), script
);
346 count
= package
->script
->ActionCount
[script
];
347 package
->script
->ActionCount
[script
]++;
349 newbuf
= msi_realloc( package
->script
->Actions
[script
],
350 package
->script
->ActionCount
[script
]* sizeof(LPWSTR
));
352 newbuf
= msi_alloc( sizeof(LPWSTR
));
354 newbuf
[count
] = strdupW(action
);
355 package
->script
->Actions
[script
] = newbuf
;
357 return ERROR_SUCCESS
;
360 static void remove_tracked_tempfiles(MSIPACKAGE
* package
)
362 struct list
*item
, *cursor
;
364 LIST_FOR_EACH_SAFE( item
, cursor
, &package
->tempfiles
)
366 MSITEMPFILE
*temp
= LIST_ENTRY( item
, MSITEMPFILE
, entry
);
368 list_remove( &temp
->entry
);
369 TRACE("deleting temp file %s\n", debugstr_w( temp
->Path
));
370 DeleteFileW( temp
->Path
);
371 msi_free( temp
->File
);
372 msi_free( temp
->Path
);
377 static void free_feature( MSIFEATURE
*feature
)
379 struct list
*item
, *cursor
;
381 LIST_FOR_EACH_SAFE( item
, cursor
, &feature
->Components
)
383 ComponentList
*cl
= LIST_ENTRY( item
, ComponentList
, entry
);
384 list_remove( &cl
->entry
);
387 msi_free( feature
->Feature
);
388 msi_free( feature
->Feature_Parent
);
389 msi_free( feature
->Directory
);
390 msi_free( feature
->Description
);
391 msi_free( feature
->Title
);
395 void free_extension( MSIEXTENSION
*ext
)
397 struct list
*item
, *cursor
;
399 LIST_FOR_EACH_SAFE( item
, cursor
, &ext
->verbs
)
401 MSIVERB
*verb
= LIST_ENTRY( item
, MSIVERB
, entry
);
403 list_remove( &verb
->entry
);
404 msi_free( verb
->Verb
);
405 msi_free( verb
->Command
);
406 msi_free( verb
->Argument
);
410 msi_free( ext
->Extension
);
411 msi_free( ext
->ProgIDText
);
415 /* Called when the package is being closed */
416 void ACTION_free_package_structures( MSIPACKAGE
* package
)
419 struct list
*item
, *cursor
;
421 TRACE("Freeing package action data\n");
423 remove_tracked_tempfiles(package
);
425 LIST_FOR_EACH_SAFE( item
, cursor
, &package
->features
)
427 MSIFEATURE
*feature
= LIST_ENTRY( item
, MSIFEATURE
, entry
);
428 list_remove( &feature
->entry
);
429 free_feature( feature
);
432 LIST_FOR_EACH_SAFE( item
, cursor
, &package
->folders
)
434 MSIFOLDER
*folder
= LIST_ENTRY( item
, MSIFOLDER
, entry
);
436 list_remove( &folder
->entry
);
437 msi_free( folder
->Directory
);
438 msi_free( folder
->TargetDefault
);
439 msi_free( folder
->SourceDefault
);
440 msi_free( folder
->ResolvedTarget
);
441 msi_free( folder
->ResolvedSource
);
442 msi_free( folder
->Property
);
446 LIST_FOR_EACH_SAFE( item
, cursor
, &package
->components
)
448 MSICOMPONENT
*comp
= LIST_ENTRY( item
, MSICOMPONENT
, entry
);
450 list_remove( &comp
->entry
);
451 msi_free( comp
->Component
);
452 msi_free( comp
->ComponentId
);
453 msi_free( comp
->Directory
);
454 msi_free( comp
->Condition
);
455 msi_free( comp
->KeyPath
);
456 msi_free( comp
->FullKeypath
);
460 LIST_FOR_EACH_SAFE( item
, cursor
, &package
->files
)
462 MSIFILE
*file
= LIST_ENTRY( item
, MSIFILE
, entry
);
464 list_remove( &file
->entry
);
465 msi_free( file
->File
);
466 msi_free( file
->FileName
);
467 msi_free( file
->ShortName
);
468 msi_free( file
->Version
);
469 msi_free( file
->Language
);
470 msi_free( file
->SourcePath
);
471 msi_free( file
->TargetPath
);
475 /* clean up extension, progid, class and verb structures */
476 LIST_FOR_EACH_SAFE( item
, cursor
, &package
->classes
)
478 MSICLASS
*cls
= LIST_ENTRY( item
, MSICLASS
, entry
);
480 list_remove( &cls
->entry
);
481 msi_free( cls
->clsid
);
482 msi_free( cls
->Context
);
483 msi_free( cls
->Description
);
484 msi_free( cls
->FileTypeMask
);
485 msi_free( cls
->IconPath
);
486 msi_free( cls
->DefInprocHandler
);
487 msi_free( cls
->DefInprocHandler32
);
488 msi_free( cls
->Argument
);
489 msi_free( cls
->ProgIDText
);
493 LIST_FOR_EACH_SAFE( item
, cursor
, &package
->extensions
)
495 MSIEXTENSION
*ext
= LIST_ENTRY( item
, MSIEXTENSION
, entry
);
497 list_remove( &ext
->entry
);
498 free_extension( ext
);
501 LIST_FOR_EACH_SAFE( item
, cursor
, &package
->progids
)
503 MSIPROGID
*progid
= LIST_ENTRY( item
, MSIPROGID
, entry
);
505 list_remove( &progid
->entry
);
506 msi_free( progid
->ProgID
);
507 msi_free( progid
->Description
);
508 msi_free( progid
->IconPath
);
512 LIST_FOR_EACH_SAFE( item
, cursor
, &package
->mimes
)
514 MSIMIME
*mt
= LIST_ENTRY( item
, MSIMIME
, entry
);
516 list_remove( &mt
->entry
);
517 msi_free( mt
->clsid
);
518 msi_free( mt
->ContentType
);
522 LIST_FOR_EACH_SAFE( item
, cursor
, &package
->appids
)
524 MSIAPPID
*appid
= LIST_ENTRY( item
, MSIAPPID
, entry
);
526 list_remove( &appid
->entry
);
527 msi_free( appid
->AppID
);
528 msi_free( appid
->RemoteServerName
);
529 msi_free( appid
->LocalServer
);
530 msi_free( appid
->ServiceParameters
);
531 msi_free( appid
->DllSurrogate
);
537 for (i
= 0; i
< TOTAL_SCRIPTS
; i
++)
540 for (j
= 0; j
< package
->script
->ActionCount
[i
]; j
++)
541 msi_free(package
->script
->Actions
[i
][j
]);
543 msi_free(package
->script
->Actions
[i
]);
546 for (i
= 0; i
< package
->script
->UniqueActionsCount
; i
++)
547 msi_free(package
->script
->UniqueActions
[i
]);
549 msi_free(package
->script
->UniqueActions
);
550 msi_free(package
->script
);
553 msi_free(package
->PackagePath
);
554 msi_free(package
->ProductCode
);
555 msi_free(package
->ActionFormat
);
556 msi_free(package
->LastAction
);
558 /* cleanup control event subscriptions */
559 ControlEvent_CleanupSubscriptions(package
);
563 * build_directory_name()
565 * This function is to save messing round with directory names
566 * It handles adding backslashes between path segments,
567 * and can add \ at the end of the directory name if told to.
569 * It takes a variable number of arguments.
570 * It always allocates a new string for the result, so make sure
571 * to free the return value when finished with it.
573 * The first arg is the number of path segments that follow.
574 * The arguments following count are a list of path segments.
575 * A path segment may be NULL.
577 * Path segments will be added with a \ separating them.
578 * A \ will not be added after the last segment, however if the
579 * last segment is NULL, then the last character will be a \
582 LPWSTR
build_directory_name(DWORD count
, ...)
589 for(i
=0; i
<count
; i
++)
591 LPCWSTR str
= va_arg(va
,LPCWSTR
);
593 sz
+= strlenW(str
) + 1;
597 dir
= msi_alloc(sz
*sizeof(WCHAR
));
601 for(i
=0; i
<count
; i
++)
603 LPCWSTR str
= va_arg(va
,LPCWSTR
);
607 if( ((i
+1)!=count
) && dir
[strlenW(dir
)-1]!='\\')
613 /***********************************************************************
616 * Recursively create all directories in the path.
618 * shamelessly stolen from setupapi/queue.c
620 BOOL
create_full_pathW(const WCHAR
*path
)
626 new_path
= msi_alloc( (strlenW(path
) + 1) * sizeof(WCHAR
));
628 strcpyW(new_path
, path
);
630 while((len
= strlenW(new_path
)) && new_path
[len
- 1] == '\\')
631 new_path
[len
- 1] = 0;
633 while(!CreateDirectoryW(new_path
, NULL
))
636 DWORD last_error
= GetLastError();
637 if(last_error
== ERROR_ALREADY_EXISTS
)
640 if(last_error
!= ERROR_PATH_NOT_FOUND
)
646 if(!(slash
= strrchrW(new_path
, '\\')))
652 len
= slash
- new_path
;
654 if(!create_full_pathW(new_path
))
659 new_path
[len
] = '\\';
666 void ui_progress(MSIPACKAGE
*package
, int a
, int b
, int c
, int d
)
670 row
= MSI_CreateRecord(4);
671 MSI_RecordSetInteger(row
,1,a
);
672 MSI_RecordSetInteger(row
,2,b
);
673 MSI_RecordSetInteger(row
,3,c
);
674 MSI_RecordSetInteger(row
,4,d
);
675 MSI_ProcessMessage(package
, INSTALLMESSAGE_PROGRESS
, row
);
676 msiobj_release(&row
->hdr
);
678 msi_dialog_check_messages(NULL
);
681 void ui_actiondata(MSIPACKAGE
*package
, LPCWSTR action
, MSIRECORD
* record
)
683 static const WCHAR Query_t
[] =
684 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
685 '`','A','c','t','i','o', 'n','T','e','x','t','`',' ',
686 'W','H','E','R','E',' ', '`','A','c','t','i','o','n','`',' ','=',
687 ' ','\'','%','s','\'',0};
691 static const WCHAR szActionData
[] =
692 {'A','c','t','i','o','n','D','a','t','a',0};
694 if (!package
->LastAction
|| strcmpW(package
->LastAction
,action
))
696 row
= MSI_QueryGetRecord(package
->db
, Query_t
, action
);
700 if (MSI_RecordIsNull(row
,3))
702 msiobj_release(&row
->hdr
);
706 /* update the cached actionformat */
707 msi_free(package
->ActionFormat
);
708 package
->ActionFormat
= msi_dup_record_field(row
,3);
710 msi_free(package
->LastAction
);
711 package
->LastAction
= strdupW(action
);
713 msiobj_release(&row
->hdr
);
716 MSI_RecordSetStringW(record
,0,package
->ActionFormat
);
718 MSI_FormatRecordW(package
,record
,message
,&size
);
720 row
= MSI_CreateRecord(1);
721 MSI_RecordSetStringW(row
,1,message
);
723 MSI_ProcessMessage(package
, INSTALLMESSAGE_ACTIONDATA
, row
);
725 ControlEvent_FireSubscribedEvent(package
,szActionData
, row
);
727 msiobj_release(&row
->hdr
);
730 BOOL
ACTION_VerifyComponentForAction( MSICOMPONENT
* comp
, INSTALLSTATE check
)
735 if (comp
->Installed
== check
)
738 if (comp
->ActionRequest
== check
)
744 BOOL
ACTION_VerifyFeatureForAction( MSIFEATURE
* feature
, INSTALLSTATE check
)
749 if (feature
->Installed
== check
)
752 if (feature
->ActionRequest
== check
)
758 void reduce_to_longfilename(WCHAR
* filename
)
760 LPWSTR p
= strchrW(filename
,'|');
762 memmove(filename
, p
+1, (strlenW(p
+1)+1)*sizeof(WCHAR
));
765 void reduce_to_shortfilename(WCHAR
* filename
)
767 LPWSTR p
= strchrW(filename
,'|');
772 LPWSTR
create_component_advertise_string(MSIPACKAGE
* package
,
773 MSICOMPONENT
* component
, LPCWSTR feature
)
776 WCHAR productid_85
[21];
777 WCHAR component_85
[21];
779 * I have a fair bit of confusion as to when a < is used and when a > is
780 * used. I do not think i have it right...
782 * Ok it appears that the > is used if there is a guid for the compoenent
783 * and the < is used if not.
785 static WCHAR fmt1
[] = {'%','s','%','s','<',0,0};
786 static WCHAR fmt2
[] = {'%','s','%','s','>','%','s',0,0};
787 LPWSTR output
= NULL
;
790 memset(productid_85
,0,sizeof(productid_85
));
791 memset(component_85
,0,sizeof(component_85
));
793 CLSIDFromString(package
->ProductCode
, &clsid
);
795 encode_base85_guid(&clsid
,productid_85
);
797 CLSIDFromString(component
->ComponentId
, &clsid
);
798 encode_base85_guid(&clsid
,component_85
);
800 TRACE("Doing something with this... %s %s %s\n",
801 debugstr_w(productid_85
), debugstr_w(feature
),
802 debugstr_w(component_85
));
804 sz
= lstrlenW(productid_85
) + lstrlenW(feature
);
806 sz
+= lstrlenW(component_85
);
811 output
= msi_alloc(sz
);
815 sprintfW(output
,fmt2
,productid_85
,feature
,component_85
);
817 sprintfW(output
,fmt1
,productid_85
,feature
);
822 /* update compoennt state based on a feature change */
823 void ACTION_UpdateComponentStates(MSIPACKAGE
*package
, LPCWSTR szFeature
)
825 INSTALLSTATE newstate
;
829 feature
= get_loaded_feature(package
,szFeature
);
833 newstate
= feature
->ActionRequest
;
835 LIST_FOR_EACH_ENTRY( cl
, &feature
->Components
, ComponentList
, entry
)
837 MSICOMPONENT
* component
= cl
->component
;
839 TRACE("MODIFYING(%i): Component %s (Installed %i, Action %i, Request %i)\n",
840 newstate
, debugstr_w(component
->Component
), component
->Installed
,
841 component
->Action
, component
->ActionRequest
);
843 if (!component
->Enabled
)
846 if (newstate
== INSTALLSTATE_LOCAL
)
848 component
->ActionRequest
= INSTALLSTATE_LOCAL
;
849 component
->Action
= INSTALLSTATE_LOCAL
;
853 ComponentList
*clist
;
856 component
->ActionRequest
= newstate
;
857 component
->Action
= newstate
;
859 /*if any other feature wants is local we need to set it local*/
860 LIST_FOR_EACH_ENTRY( f
, &package
->features
, MSIFEATURE
, entry
)
862 if ( component
->ActionRequest
!= INSTALLSTATE_LOCAL
)
865 LIST_FOR_EACH_ENTRY( clist
, &f
->Components
, ComponentList
, entry
)
867 if ( clist
->component
== component
)
869 if (f
->ActionRequest
== INSTALLSTATE_LOCAL
)
871 TRACE("Saved by %s\n", debugstr_w(f
->Feature
));
872 component
->ActionRequest
= INSTALLSTATE_LOCAL
;
873 component
->Action
= INSTALLSTATE_LOCAL
;
880 TRACE("Result (%i): Component %s (Installed %i, Action %i, Request %i)\n",
881 newstate
, debugstr_w(component
->Component
), component
->Installed
,
882 component
->Action
, component
->ActionRequest
);
886 UINT
register_unique_action(MSIPACKAGE
*package
, LPCWSTR action
)
889 LPWSTR
*newbuf
= NULL
;
891 if (!package
->script
)
894 TRACE("Registering Action %s as having fun\n",debugstr_w(action
));
896 count
= package
->script
->UniqueActionsCount
;
897 package
->script
->UniqueActionsCount
++;
899 newbuf
= msi_realloc( package
->script
->UniqueActions
,
900 package
->script
->UniqueActionsCount
* sizeof(LPWSTR
));
902 newbuf
= msi_alloc( sizeof(LPWSTR
));
904 newbuf
[count
] = strdupW(action
);
905 package
->script
->UniqueActions
= newbuf
;
907 return ERROR_SUCCESS
;
910 BOOL
check_unique_action(MSIPACKAGE
*package
, LPCWSTR action
)
914 if (!package
->script
)
917 for (i
= 0; i
< package
->script
->UniqueActionsCount
; i
++)
918 if (!strcmpW(package
->script
->UniqueActions
[i
],action
))
924 WCHAR
* generate_error_string(MSIPACKAGE
*package
, UINT error
, DWORD count
, ... )
926 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};
936 row
= MSI_QueryGetRecord(package
->db
, query
, error
);
940 rec
= MSI_CreateRecord(count
+2);
942 str
= MSI_RecordGetString(row
,1);
943 MSI_RecordSetStringW(rec
,0,str
);
944 msiobj_release( &row
->hdr
);
945 MSI_RecordSetInteger(rec
,1,error
);
948 for (i
= 0; i
< count
; i
++)
950 str
= va_arg(va
,LPCWSTR
);
951 MSI_RecordSetStringW(rec
,(i
+2),str
);
955 MSI_FormatRecordW(package
,rec
,NULL
,&size
);
959 data
= msi_alloc(size
*sizeof(WCHAR
));
961 MSI_FormatRecordW(package
,rec
,data
,&size
);
964 msiobj_release( &rec
->hdr
);
968 msiobj_release( &rec
->hdr
);