mshtml: Added IHTMLImgElement::width property implementation.
[wine/multimedia.git] / dlls / msi / custom.c
blob2b2a3e1373fc21040fd5c1e6a75f7ac95ce821d1
1 /*
2 * Custom Action processing for 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 #include "config.h"
22 #include "wine/port.h"
24 #define COBJMACROS
26 #include <stdarg.h>
27 #include "windef.h"
28 #include "winbase.h"
29 #include "winerror.h"
30 #include "msidefs.h"
31 #include "winuser.h"
32 #include "objbase.h"
33 #include "oleauto.h"
35 #include "msipriv.h"
36 #include "msiserver.h"
37 #include "wine/debug.h"
38 #include "wine/unicode.h"
39 #include "wine/exception.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(msi);
43 #define CUSTOM_ACTION_TYPE_MASK 0x3F
44 static const WCHAR c_collen[] = {'C',':','\\',0};
45 static const WCHAR cszTempFolder[]= {'T','e','m','p','F','o','l','d','e','r',0};
47 typedef struct tagMSIRUNNINGACTION
49 struct list entry;
50 HANDLE handle;
51 BOOL process;
52 LPWSTR name;
53 } MSIRUNNINGACTION;
55 static UINT HANDLE_CustomType1(MSIPACKAGE *package, LPCWSTR source,
56 LPCWSTR target, const INT type, LPCWSTR action);
57 static UINT HANDLE_CustomType2(MSIPACKAGE *package, LPCWSTR source,
58 LPCWSTR target, const INT type, LPCWSTR action);
59 static UINT HANDLE_CustomType17(MSIPACKAGE *package, LPCWSTR source,
60 LPCWSTR target, const INT type, LPCWSTR action);
61 static UINT HANDLE_CustomType18(MSIPACKAGE *package, LPCWSTR source,
62 LPCWSTR target, const INT type, LPCWSTR action);
63 static UINT HANDLE_CustomType19(MSIPACKAGE *package, LPCWSTR source,
64 LPCWSTR target, const INT type, LPCWSTR action);
65 static UINT HANDLE_CustomType23(MSIPACKAGE *package, LPCWSTR source,
66 LPCWSTR target, const INT type, LPCWSTR action);
67 static UINT HANDLE_CustomType50(MSIPACKAGE *package, LPCWSTR source,
68 LPCWSTR target, const INT type, LPCWSTR action);
69 static UINT HANDLE_CustomType34(MSIPACKAGE *package, LPCWSTR source,
70 LPCWSTR target, const INT type, LPCWSTR action);
71 static UINT HANDLE_CustomType37_38(MSIPACKAGE *package, LPCWSTR source,
72 LPCWSTR target, const INT type, LPCWSTR action);
73 static UINT HANDLE_CustomType5_6(MSIPACKAGE *package, LPCWSTR source,
74 LPCWSTR target, const INT type, LPCWSTR action);
75 static UINT HANDLE_CustomType21_22(MSIPACKAGE *package, LPCWSTR source,
76 LPCWSTR target, const INT type, LPCWSTR action);
77 static UINT HANDLE_CustomType53_54(MSIPACKAGE *package, LPCWSTR source,
78 LPCWSTR target, const INT type, LPCWSTR action);
80 typedef UINT (WINAPI *MsiCustomActionEntryPoint)( MSIHANDLE );
82 static CRITICAL_SECTION msi_custom_action_cs;
83 static CRITICAL_SECTION_DEBUG msi_custom_action_cs_debug =
85 0, 0, &msi_custom_action_cs,
86 { &msi_custom_action_cs_debug.ProcessLocksList,
87 &msi_custom_action_cs_debug.ProcessLocksList },
88 0, 0, { (DWORD_PTR)(__FILE__ ": msi_custom_action_cs") }
90 static CRITICAL_SECTION msi_custom_action_cs = { &msi_custom_action_cs_debug, -1, 0, 0, 0, 0 };
92 static struct list msi_pending_custom_actions = LIST_INIT( msi_pending_custom_actions );
94 static BOOL check_execution_scheduling_options(MSIPACKAGE *package, LPCWSTR action, UINT options)
96 if (!package->script)
97 return TRUE;
99 if ((options & msidbCustomActionTypeClientRepeat) ==
100 msidbCustomActionTypeClientRepeat)
102 if (!(package->script->InWhatSequence & SEQUENCE_UI &&
103 package->script->InWhatSequence & SEQUENCE_EXEC))
105 TRACE("Skipping action due to dbCustomActionTypeClientRepeat option.\n");
106 return FALSE;
109 else if (options & msidbCustomActionTypeFirstSequence)
111 if (package->script->InWhatSequence & SEQUENCE_UI &&
112 package->script->InWhatSequence & SEQUENCE_EXEC )
114 TRACE("Skipping action due to msidbCustomActionTypeFirstSequence option.\n");
115 return FALSE;
118 else if (options & msidbCustomActionTypeOncePerProcess)
120 if (check_unique_action(package,action))
122 TRACE("Skipping action due to msidbCustomActionTypeOncePerProcess option.\n");
123 return FALSE;
125 else
126 register_unique_action(package,action);
129 return TRUE;
132 /* stores the following properties before the action:
134 * [CustomActionData<=>UserSID<=>ProductCode]Action
136 static LPWSTR msi_get_deferred_action(LPCWSTR action, LPCWSTR actiondata,
137 LPCWSTR usersid, LPCWSTR prodcode)
139 LPWSTR deferred;
140 DWORD len;
142 static const WCHAR format[] = {
143 '[','%','s','<','=','>','%','s','<','=','>','%','s',']','%','s',0
146 if (!actiondata)
147 return strdupW(action);
149 len = lstrlenW(action) + lstrlenW(actiondata) +
150 lstrlenW(usersid) + lstrlenW(prodcode) +
151 lstrlenW(format) - 7;
152 deferred = msi_alloc(len * sizeof(WCHAR));
154 sprintfW(deferred, format, actiondata, usersid, prodcode, action);
155 return deferred;
158 static void set_deferred_action_props(MSIPACKAGE *package, LPWSTR deferred_data)
160 LPWSTR end, beg = deferred_data + 1;
162 static const WCHAR sep[] = {'<','=','>',0};
164 end = strstrW(beg, sep);
165 *end = '\0';
166 MSI_SetPropertyW(package, szCustomActionData, beg);
167 beg = end + 3;
169 end = strstrW(beg, sep);
170 *end = '\0';
171 MSI_SetPropertyW(package, szUserSID, beg);
172 beg = end + 3;
174 end = strchrW(beg, ']');
175 *end = '\0';
176 MSI_SetPropertyW(package, szProductCode, beg);
179 UINT ACTION_CustomAction(MSIPACKAGE *package, LPCWSTR action, UINT script, BOOL execute)
181 UINT rc = ERROR_SUCCESS;
182 MSIRECORD * row = 0;
183 static const WCHAR ExecSeqQuery[] =
184 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
185 '`','C','u','s','t','o' ,'m','A','c','t','i','o','n','`',
186 ' ','W','H','E','R','E',' ','`','A','c','t','i' ,'o','n','`',' ',
187 '=',' ','\'','%','s','\'',0};
188 UINT type;
189 LPCWSTR source, target;
190 LPWSTR ptr, deferred_data = NULL;
191 LPWSTR action_copy = strdupW(action);
192 WCHAR *deformated=NULL;
194 /* deferred action: [properties]Action */
195 if ((ptr = strrchrW(action_copy, ']')))
197 deferred_data = action_copy;
198 action = ptr + 1;
201 row = MSI_QueryGetRecord( package->db, ExecSeqQuery, action );
202 if (!row)
204 msi_free(action_copy);
205 return ERROR_CALL_NOT_IMPLEMENTED;
208 type = MSI_RecordGetInteger(row,2);
210 source = MSI_RecordGetString(row,3);
211 target = MSI_RecordGetString(row,4);
213 TRACE("Handling custom action %s (%x %s %s)\n",debugstr_w(action),type,
214 debugstr_w(source), debugstr_w(target));
216 /* handle some of the deferred actions */
217 if (type & msidbCustomActionTypeTSAware)
218 FIXME("msidbCustomActionTypeTSAware not handled\n");
220 if (type & msidbCustomActionTypeInScript)
222 if (type & msidbCustomActionTypeNoImpersonate)
223 WARN("msidbCustomActionTypeNoImpersonate not handled\n");
225 if (type & msidbCustomActionTypeRollback)
227 FIXME("Rollback only action... rollbacks not supported yet\n");
228 schedule_action(package, ROLLBACK_SCRIPT, action);
229 rc = ERROR_SUCCESS;
230 goto end;
232 if (!execute)
234 LPWSTR actiondata = msi_dup_property(package, action);
235 LPWSTR usersid = msi_dup_property(package, szUserSID);
236 LPWSTR prodcode = msi_dup_property(package, szProductCode);
237 LPWSTR deferred = msi_get_deferred_action(action, actiondata, usersid, prodcode);
239 if (type & msidbCustomActionTypeCommit)
241 TRACE("Deferring Commit Action!\n");
242 schedule_action(package, COMMIT_SCRIPT, deferred);
244 else
246 TRACE("Deferring Action!\n");
247 schedule_action(package, INSTALL_SCRIPT, deferred);
250 rc = ERROR_SUCCESS;
251 msi_free(actiondata);
252 msi_free(usersid);
253 msi_free(prodcode);
254 msi_free(deferred);
255 goto end;
257 else
259 LPWSTR actiondata = msi_dup_property( package, action );
261 switch (script)
263 case INSTALL_SCRIPT:
264 package->scheduled_action_running = TRUE;
265 break;
266 case COMMIT_SCRIPT:
267 package->commit_action_running = TRUE;
268 break;
269 case ROLLBACK_SCRIPT:
270 package->rollback_action_running = TRUE;
271 break;
272 default:
273 break;
276 if (deferred_data)
277 set_deferred_action_props(package, deferred_data);
278 else if (actiondata)
279 MSI_SetPropertyW(package, szCustomActionData, actiondata);
280 else
281 MSI_SetPropertyW(package, szCustomActionData, szEmpty);
283 msi_free(actiondata);
286 else if (!check_execution_scheduling_options(package,action,type))
288 rc = ERROR_SUCCESS;
289 goto end;
292 switch (type & CUSTOM_ACTION_TYPE_MASK)
294 case 1: /* DLL file stored in a Binary table stream */
295 rc = HANDLE_CustomType1(package,source,target,type,action);
296 break;
297 case 2: /* EXE file stored in a Binary table stream */
298 rc = HANDLE_CustomType2(package,source,target,type,action);
299 break;
300 case 18: /*EXE file installed with package */
301 rc = HANDLE_CustomType18(package,source,target,type,action);
302 break;
303 case 19: /* Error that halts install */
304 rc = HANDLE_CustomType19(package,source,target,type,action);
305 break;
306 case 17:
307 rc = HANDLE_CustomType17(package,source,target,type,action);
308 break;
309 case 23: /* installs another package in the source tree */
310 deformat_string(package,target,&deformated);
311 rc = HANDLE_CustomType23(package,source,deformated,type,action);
312 msi_free(deformated);
313 break;
314 case 50: /*EXE file specified by a property value */
315 rc = HANDLE_CustomType50(package,source,target,type,action);
316 break;
317 case 34: /*EXE to be run in specified directory */
318 rc = HANDLE_CustomType34(package,source,target,type,action);
319 break;
320 case 35: /* Directory set with formatted text. */
321 deformat_string(package,target,&deformated);
322 MSI_SetTargetPathW(package, source, deformated);
323 msi_free(deformated);
324 break;
325 case 51: /* Property set with formatted text. */
326 if (!source)
327 break;
329 deformat_string(package,target,&deformated);
330 rc = MSI_SetPropertyW(package,source,deformated);
331 msi_free(deformated);
332 break;
333 case 37: /* JScript/VBScript text stored in target column. */
334 case 38:
335 rc = HANDLE_CustomType37_38(package,source,target,type,action);
336 break;
337 case 5:
338 case 6: /* JScript/VBScript file stored in a Binary table stream. */
339 rc = HANDLE_CustomType5_6(package,source,target,type,action);
340 break;
341 case 21: /* JScript/VBScript file installed with the product. */
342 case 22:
343 rc = HANDLE_CustomType21_22(package,source,target,type,action);
344 break;
345 case 53: /* JScript/VBScript text specified by a property value. */
346 case 54:
347 rc = HANDLE_CustomType53_54(package,source,target,type,action);
348 break;
349 default:
350 FIXME("UNHANDLED ACTION TYPE %i (%s %s)\n",
351 type & CUSTOM_ACTION_TYPE_MASK, debugstr_w(source),
352 debugstr_w(target));
355 end:
356 package->scheduled_action_running = FALSE;
357 package->commit_action_running = FALSE;
358 package->rollback_action_running = FALSE;
359 msi_free(action_copy);
360 msiobj_release(&row->hdr);
361 return rc;
365 static UINT store_binary_to_temp(MSIPACKAGE *package, LPCWSTR source,
366 LPWSTR tmp_file)
368 static const WCHAR query[] = {
369 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
370 '`','B','i' ,'n','a','r','y','`',' ','W','H','E','R','E',' ',
371 '`','N','a','m','e','`',' ','=',' ','\'','%','s','\'',0};
372 MSIRECORD *row = 0;
373 HANDLE file;
374 CHAR buffer[1024];
375 WCHAR fmt[MAX_PATH];
376 DWORD sz = MAX_PATH;
377 UINT r;
379 if (MSI_GetPropertyW(package, cszTempFolder, fmt, &sz) != ERROR_SUCCESS)
380 GetTempPathW(MAX_PATH, fmt);
382 if (GetTempFileNameW(fmt, szMsi, 0, tmp_file) == 0)
384 TRACE("Unable to create file\n");
385 return ERROR_FUNCTION_FAILED;
387 track_tempfile(package, tmp_file);
389 row = MSI_QueryGetRecord(package->db, query, source);
390 if (!row)
391 return ERROR_FUNCTION_FAILED;
393 /* write out the file */
394 file = CreateFileW(tmp_file, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
395 FILE_ATTRIBUTE_NORMAL, NULL);
396 if (file == INVALID_HANDLE_VALUE)
397 r = ERROR_FUNCTION_FAILED;
398 else
402 DWORD write;
403 sz = sizeof buffer;
404 r = MSI_RecordReadStream(row, 2, buffer, &sz);
405 if (r != ERROR_SUCCESS)
407 ERR("Failed to get stream\n");
408 break;
410 WriteFile(file, buffer, sz, &write, NULL);
411 } while (sz == sizeof buffer);
412 CloseHandle(file);
415 msiobj_release(&row->hdr);
417 return r;
420 static void file_running_action(MSIPACKAGE* package, HANDLE Handle,
421 BOOL process, LPCWSTR name)
423 MSIRUNNINGACTION *action;
425 action = msi_alloc( sizeof(MSIRUNNINGACTION) );
427 action->handle = Handle;
428 action->process = process;
429 action->name = strdupW(name);
431 list_add_tail( &package->RunningActions, &action->entry );
434 static UINT custom_get_process_return( HANDLE process )
436 DWORD rc = 0;
438 GetExitCodeProcess( process, &rc );
439 if (rc != 0)
440 return ERROR_FUNCTION_FAILED;
441 return ERROR_SUCCESS;
444 static UINT custom_get_thread_return( MSIPACKAGE *package, HANDLE thread )
446 DWORD rc = 0;
448 GetExitCodeThread( thread, &rc );
450 switch (rc)
452 case ERROR_FUNCTION_NOT_CALLED:
453 case ERROR_SUCCESS:
454 case ERROR_INSTALL_USEREXIT:
455 case ERROR_INSTALL_FAILURE:
456 return rc;
457 case ERROR_NO_MORE_ITEMS:
458 return ERROR_SUCCESS;
459 case ERROR_INSTALL_SUSPEND:
460 ACTION_ForceReboot( package );
461 return ERROR_SUCCESS;
462 default:
463 ERR("Invalid Return Code %d\n",rc);
464 return ERROR_INSTALL_FAILURE;
468 static UINT wait_process_handle(MSIPACKAGE* package, UINT type,
469 HANDLE ProcessHandle, LPCWSTR name)
471 UINT rc = ERROR_SUCCESS;
473 if (!(type & msidbCustomActionTypeAsync))
475 TRACE("waiting for %s\n", debugstr_w(name));
477 msi_dialog_check_messages(ProcessHandle);
479 if (!(type & msidbCustomActionTypeContinue))
480 rc = custom_get_process_return(ProcessHandle);
482 CloseHandle(ProcessHandle);
484 else
486 TRACE("%s running in background\n", debugstr_w(name));
488 if (!(type & msidbCustomActionTypeContinue))
489 file_running_action(package, ProcessHandle, TRUE, name);
490 else
491 CloseHandle(ProcessHandle);
494 return rc;
497 typedef struct _msi_custom_action_info {
498 struct list entry;
499 LONG refs;
500 MSIPACKAGE *package;
501 LPWSTR source;
502 LPWSTR target;
503 HANDLE handle;
504 LPWSTR action;
505 INT type;
506 GUID guid;
507 } msi_custom_action_info;
509 static void release_custom_action_data( msi_custom_action_info *info )
511 EnterCriticalSection( &msi_custom_action_cs );
513 if (!--info->refs)
515 list_remove( &info->entry );
516 if (info->handle)
517 CloseHandle( info->handle );
518 msi_free( info->action );
519 msi_free( info->source );
520 msi_free( info->target );
521 msiobj_release( &info->package->hdr );
522 msi_free( info );
525 LeaveCriticalSection( &msi_custom_action_cs );
528 /* must be called inside msi_custom_action_cs if info is in the pending custom actions list */
529 static void addref_custom_action_data( msi_custom_action_info *info )
531 info->refs++;
534 static UINT wait_thread_handle( msi_custom_action_info *info )
536 UINT rc = ERROR_SUCCESS;
538 if (!(info->type & msidbCustomActionTypeAsync))
540 TRACE("waiting for %s\n", debugstr_w( info->action ));
542 msi_dialog_check_messages( info->handle );
544 if (!(info->type & msidbCustomActionTypeContinue))
545 rc = custom_get_thread_return( info->package, info->handle );
547 release_custom_action_data( info );
549 else
551 TRACE("%s running in background\n", debugstr_w( info->action ));
554 return rc;
557 static msi_custom_action_info *find_action_by_guid( const GUID *guid )
559 msi_custom_action_info *info;
560 BOOL found = FALSE;
562 EnterCriticalSection( &msi_custom_action_cs );
564 LIST_FOR_EACH_ENTRY( info, &msi_pending_custom_actions, msi_custom_action_info, entry )
566 if (IsEqualGUID( &info->guid, guid ))
568 addref_custom_action_data( info );
569 found = TRUE;
570 break;
574 LeaveCriticalSection( &msi_custom_action_cs );
576 if (!found)
577 return NULL;
579 return info;
582 static void handle_msi_break( LPCWSTR target )
584 LPWSTR msg;
585 WCHAR val[MAX_PATH];
587 static const WCHAR MsiBreak[] = { 'M','s','i','B','r','e','a','k',0 };
588 static const WCHAR WindowsInstaller[] = {
589 'W','i','n','d','o','w','s',' ','I','n','s','t','a','l','l','e','r',0
592 static const WCHAR format[] = {
593 'T','o',' ','d','e','b','u','g',' ','y','o','u','r',' ',
594 'c','u','s','t','o','m',' ','a','c','t','i','o','n',',',' ',
595 'a','t','t','a','c','h',' ','y','o','u','r',' ','d','e','b','u','g','g','e','r',' ',
596 't','o',' ','p','r','o','c','e','s','s',' ','%','i',' ','(','0','x','%','X',')',' ',
597 'a','n','d',' ','p','r','e','s','s',' ','O','K',0
600 if( !GetEnvironmentVariableW( MsiBreak, val, MAX_PATH ))
601 return;
603 if( lstrcmpiW( val, target ))
604 return;
606 msg = msi_alloc( (lstrlenW(format) + 10) * sizeof(WCHAR) );
607 if (!msg)
608 return;
610 wsprintfW( msg, format, GetCurrentProcessId(), GetCurrentProcessId());
611 MessageBoxW( NULL, msg, WindowsInstaller, MB_OK);
612 msi_free(msg);
613 DebugBreak();
616 static UINT get_action_info( const GUID *guid, INT *type, MSIHANDLE *handle,
617 BSTR *dll, BSTR *funcname,
618 IWineMsiRemotePackage **package )
620 IClassFactory *cf = NULL;
621 IWineMsiRemoteCustomAction *rca = NULL;
622 HRESULT r;
624 r = DllGetClassObject( &CLSID_IWineMsiRemoteCustomAction,
625 &IID_IClassFactory, (LPVOID *)&cf );
626 if (FAILED(r))
628 ERR("failed to get IClassFactory interface\n");
629 return ERROR_FUNCTION_FAILED;
632 r = IClassFactory_CreateInstance( cf, NULL, &IID_IWineMsiRemoteCustomAction, (LPVOID *)&rca );
633 if (FAILED(r))
635 ERR("failed to get IWineMsiRemoteCustomAction interface\n");
636 return ERROR_FUNCTION_FAILED;
639 r = IWineMsiRemoteCustomAction_GetActionInfo( rca, guid, type, handle, dll, funcname, package );
640 IWineMsiRemoteCustomAction_Release( rca );
641 if (FAILED(r))
643 ERR("GetActionInfo failed\n");
644 return ERROR_FUNCTION_FAILED;
647 return ERROR_SUCCESS;
650 #ifdef __i386__
651 extern UINT CUSTOMPROC_wrapper( MsiCustomActionEntryPoint proc, MSIHANDLE handle );
652 __ASM_GLOBAL_FUNC( CUSTOMPROC_wrapper,
653 "pushl %ebp\n\t"
654 __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
655 __ASM_CFI(".cfi_rel_offset %ebp,0\n\t")
656 "movl %esp,%ebp\n\t"
657 __ASM_CFI(".cfi_def_cfa_register %ebp\n\t")
658 "pushl 12(%ebp)\n\t"
659 "movl 8(%ebp),%eax\n\t"
660 "call *%eax\n\t"
661 "leave\n\t"
662 __ASM_CFI(".cfi_def_cfa %esp,4\n\t")
663 __ASM_CFI(".cfi_same_value %ebp\n\t")
664 "ret" )
665 #else
666 static inline UINT CUSTOMPROC_wrapper( MsiCustomActionEntryPoint proc, MSIHANDLE handle )
668 return proc(handle);
670 #endif
672 static DWORD ACTION_CallDllFunction( const GUID *guid )
674 MsiCustomActionEntryPoint fn;
675 MSIHANDLE hPackage, handle;
676 HANDLE hModule;
677 LPSTR proc;
678 UINT r = ERROR_FUNCTION_FAILED;
679 BSTR dll = NULL, function = NULL;
680 INT type;
681 IWineMsiRemotePackage *remote_package = NULL;
683 TRACE("%s\n", debugstr_guid( guid ));
685 r = get_action_info( guid, &type, &handle, &dll, &function, &remote_package );
686 if (r != ERROR_SUCCESS)
687 return r;
689 hModule = LoadLibraryW( dll );
690 if (!hModule)
692 ERR("failed to load dll %s (%u)\n", debugstr_w( dll ), GetLastError() );
693 return r;
696 proc = strdupWtoA( function );
697 fn = (MsiCustomActionEntryPoint) GetProcAddress( hModule, proc );
698 msi_free( proc );
699 if (fn)
701 hPackage = alloc_msi_remote_handle( (IUnknown *)remote_package );
702 if (hPackage)
704 IWineMsiRemotePackage_SetMsiHandle( remote_package, handle );
705 TRACE("calling %s\n", debugstr_w( function ) );
706 handle_msi_break( function );
708 __TRY
710 r = CUSTOMPROC_wrapper( fn, hPackage );
712 __EXCEPT_PAGE_FAULT
714 ERR("Custom action (%s:%s) caused a page fault: %08x\n",
715 debugstr_w(dll), debugstr_w(function), GetExceptionCode());
716 r = ERROR_SUCCESS;
718 __ENDTRY;
720 MsiCloseHandle( hPackage );
722 else
723 ERR("failed to create handle for %p\n", remote_package );
725 else
726 ERR("GetProcAddress(%s) failed\n", debugstr_w( function ) );
728 FreeLibrary(hModule);
730 IWineMsiRemotePackage_Release( remote_package );
731 SysFreeString( dll );
732 SysFreeString( function );
733 MsiCloseHandle( handle );
735 return r;
738 static DWORD WINAPI DllThread( LPVOID arg )
740 LPGUID guid = arg;
741 DWORD rc = 0;
743 TRACE("custom action (%x) started\n", GetCurrentThreadId() );
745 rc = ACTION_CallDllFunction( guid );
747 TRACE("custom action (%x) returned %i\n", GetCurrentThreadId(), rc );
749 MsiCloseAllHandles();
750 return rc;
753 static DWORD ACTION_CAInstallPackage(const GUID *guid)
755 msi_custom_action_info *info;
756 UINT r = ERROR_FUNCTION_FAILED;
757 INSTALLUILEVEL old_level;
759 info = find_action_by_guid(guid);
760 if (!info)
762 ERR("failed to find action %s\n", debugstr_guid(guid));
763 return r;
766 old_level = MsiSetInternalUI(INSTALLUILEVEL_BASIC, NULL);
767 r = MsiInstallProductW(info->source, info->target);
768 MsiSetInternalUI(old_level, NULL);
770 release_custom_action_data(info);
772 return r;
775 static DWORD WINAPI ConcurrentInstallThread(LPVOID arg)
777 LPGUID guid = arg;
778 DWORD rc;
780 TRACE("concurrent installation (%x) started\n", GetCurrentThreadId());
782 rc = ACTION_CAInstallPackage(guid);
784 TRACE("concurrent installation (%x) returned %i\n", GetCurrentThreadId(), rc);
786 MsiCloseAllHandles();
787 return rc;
790 static msi_custom_action_info *do_msidbCustomActionTypeDll(
791 MSIPACKAGE *package, INT type, LPCWSTR source, LPCWSTR target, LPCWSTR action )
793 msi_custom_action_info *info;
795 info = msi_alloc( sizeof *info );
796 if (!info)
797 return NULL;
799 msiobj_addref( &package->hdr );
800 info->refs = 2; /* 1 for our caller and 1 for thread we created */
801 info->package = package;
802 info->type = type;
803 info->target = strdupW( target );
804 info->source = strdupW( source );
805 info->action = strdupW( action );
806 CoCreateGuid( &info->guid );
808 EnterCriticalSection( &msi_custom_action_cs );
809 list_add_tail( &msi_pending_custom_actions, &info->entry );
810 LeaveCriticalSection( &msi_custom_action_cs );
812 info->handle = CreateThread( NULL, 0, DllThread, &info->guid, 0, NULL );
813 if (!info->handle)
815 /* release both references */
816 release_custom_action_data( info );
817 release_custom_action_data( info );
818 return NULL;
821 return info;
824 static msi_custom_action_info *do_msidbCAConcurrentInstall(
825 MSIPACKAGE *package, INT type, LPCWSTR source, LPCWSTR target, LPCWSTR action)
827 msi_custom_action_info *info;
829 info = msi_alloc( sizeof *info );
830 if (!info)
831 return NULL;
833 msiobj_addref( &package->hdr );
834 info->refs = 2; /* 1 for our caller and 1 for thread we created */
835 info->package = package;
836 info->type = type;
837 info->target = strdupW( target );
838 info->source = strdupW( source );
839 info->action = strdupW( action );
840 CoCreateGuid( &info->guid );
842 EnterCriticalSection( &msi_custom_action_cs );
843 list_add_tail( &msi_pending_custom_actions, &info->entry );
844 LeaveCriticalSection( &msi_custom_action_cs );
846 info->handle = CreateThread( NULL, 0, ConcurrentInstallThread, &info->guid, 0, NULL );
847 if (!info->handle)
849 /* release both references */
850 release_custom_action_data( info );
851 release_custom_action_data( info );
852 return NULL;
855 return info;
858 static UINT HANDLE_CustomType23(MSIPACKAGE *package, LPCWSTR source,
859 LPCWSTR target, const INT type, LPCWSTR action)
861 msi_custom_action_info *info;
862 WCHAR package_path[MAX_PATH];
863 DWORD size;
864 UINT r;
866 size = MAX_PATH;
867 MSI_GetPropertyW(package, cszSourceDir, package_path, &size);
868 lstrcatW(package_path, szBackSlash);
869 lstrcatW(package_path, source);
871 TRACE("Installing package %s concurrently\n", debugstr_w(package_path));
873 info = do_msidbCAConcurrentInstall(package, type, package_path, target, action);
875 r = wait_thread_handle(info);
876 release_custom_action_data( info );
877 return r;
880 static UINT HANDLE_CustomType1(MSIPACKAGE *package, LPCWSTR source,
881 LPCWSTR target, const INT type, LPCWSTR action)
883 msi_custom_action_info *info;
884 WCHAR tmp_file[MAX_PATH];
885 UINT r;
887 r = store_binary_to_temp(package, source, tmp_file);
888 if (r != ERROR_SUCCESS)
889 return r;
891 TRACE("Calling function %s from %s\n",debugstr_w(target),
892 debugstr_w(tmp_file));
894 if (!strchrW(tmp_file,'.'))
895 strcatW(tmp_file, szDot);
897 info = do_msidbCustomActionTypeDll( package, type, tmp_file, target, action );
899 r = wait_thread_handle( info );
900 release_custom_action_data( info );
901 return r;
904 static UINT HANDLE_CustomType2(MSIPACKAGE *package, LPCWSTR source,
905 LPCWSTR target, const INT type, LPCWSTR action)
907 WCHAR tmp_file[MAX_PATH];
908 STARTUPINFOW si;
909 PROCESS_INFORMATION info;
910 BOOL rc;
911 INT len;
912 WCHAR *deformated = NULL;
913 WCHAR *cmd;
914 static const WCHAR spc[] = {' ',0};
915 UINT r;
917 memset(&si,0,sizeof(STARTUPINFOW));
919 r = store_binary_to_temp(package, source, tmp_file);
920 if (r != ERROR_SUCCESS)
921 return r;
923 deformat_string(package,target,&deformated);
925 len = strlenW(tmp_file)+2;
927 if (deformated)
928 len += strlenW(deformated);
930 cmd = msi_alloc(sizeof(WCHAR)*len);
932 strcpyW(cmd,tmp_file);
933 if (deformated)
935 strcatW(cmd,spc);
936 strcatW(cmd,deformated);
938 msi_free(deformated);
941 TRACE("executing exe %s\n", debugstr_w(cmd));
943 rc = CreateProcessW(NULL, cmd, NULL, NULL, FALSE, 0, NULL,
944 c_collen, &si, &info);
945 msi_free(cmd);
947 if ( !rc )
949 ERR("Unable to execute command %s\n", debugstr_w(cmd));
950 return ERROR_SUCCESS;
952 CloseHandle( info.hThread );
954 r = wait_process_handle(package, type, info.hProcess, action);
956 return r;
959 static UINT HANDLE_CustomType17(MSIPACKAGE *package, LPCWSTR source,
960 LPCWSTR target, const INT type, LPCWSTR action)
962 msi_custom_action_info *info;
963 MSIFILE *file;
964 UINT r;
966 TRACE("%s %s\n", debugstr_w(source), debugstr_w(target));
968 file = get_loaded_file( package, source );
969 if (!file)
971 ERR("invalid file key %s\n", debugstr_w( source ));
972 return ERROR_FUNCTION_FAILED;
975 info = do_msidbCustomActionTypeDll( package, type, file->TargetPath, target, action );
977 r = wait_thread_handle( info );
978 release_custom_action_data( info );
979 return r;
982 static UINT HANDLE_CustomType18(MSIPACKAGE *package, LPCWSTR source,
983 LPCWSTR target, const INT type, LPCWSTR action)
985 STARTUPINFOW si;
986 PROCESS_INFORMATION info;
987 BOOL rc;
988 WCHAR *deformated;
989 WCHAR *cmd;
990 INT len;
991 static const WCHAR spc[] = {' ',0};
992 MSIFILE *file;
994 memset(&si,0,sizeof(STARTUPINFOW));
996 file = get_loaded_file(package,source);
997 if( !file )
998 return ERROR_FUNCTION_FAILED;
1000 len = lstrlenW( file->TargetPath );
1002 deformat_string(package,target,&deformated);
1003 if (deformated)
1004 len += strlenW(deformated);
1005 len += 2;
1007 cmd = msi_alloc(len * sizeof(WCHAR));
1009 lstrcpyW( cmd, file->TargetPath);
1010 if (deformated)
1012 strcatW(cmd, spc);
1013 strcatW(cmd, deformated);
1015 msi_free(deformated);
1018 TRACE("executing exe %s\n", debugstr_w(cmd));
1020 rc = CreateProcessW(NULL, cmd, NULL, NULL, FALSE, 0, NULL,
1021 c_collen, &si, &info);
1023 if ( !rc )
1025 ERR("Unable to execute command %s\n", debugstr_w(cmd));
1026 msi_free(cmd);
1027 return ERROR_SUCCESS;
1029 msi_free(cmd);
1030 CloseHandle( info.hThread );
1032 return wait_process_handle(package, type, info.hProcess, action);
1035 static UINT HANDLE_CustomType19(MSIPACKAGE *package, LPCWSTR source,
1036 LPCWSTR target, const INT type, LPCWSTR action)
1038 static const WCHAR query[] = {
1039 'S','E','L','E','C','T',' ','`','M','e','s','s','a','g','e','`',' ',
1040 'F','R','O','M',' ','`','E','r','r','o','r','`',' ',
1041 'W','H','E','R','E',' ','`','E','r','r','o','r','`',' ','=',' ',
1042 '%','s',0
1044 MSIRECORD *row = 0;
1045 LPWSTR deformated = NULL;
1047 deformat_string( package, target, &deformated );
1049 /* first try treat the error as a number */
1050 row = MSI_QueryGetRecord( package->db, query, deformated );
1051 if( row )
1053 LPCWSTR error = MSI_RecordGetString( row, 1 );
1054 if ((gUILevel & INSTALLUILEVEL_MASK) != INSTALLUILEVEL_NONE)
1055 MessageBoxW( NULL, error, NULL, MB_OK );
1056 msiobj_release( &row->hdr );
1058 else if ((gUILevel & INSTALLUILEVEL_MASK) != INSTALLUILEVEL_NONE)
1059 MessageBoxW( NULL, deformated, NULL, MB_OK );
1061 msi_free( deformated );
1063 return ERROR_INSTALL_FAILURE;
1066 static UINT HANDLE_CustomType50(MSIPACKAGE *package, LPCWSTR source,
1067 LPCWSTR target, const INT type, LPCWSTR action)
1069 STARTUPINFOW si;
1070 PROCESS_INFORMATION info;
1071 WCHAR *prop;
1072 BOOL rc;
1073 WCHAR *deformated;
1074 WCHAR *cmd;
1075 INT len;
1076 static const WCHAR spc[] = {' ',0};
1078 memset(&si,0,sizeof(STARTUPINFOW));
1079 memset(&info,0,sizeof(PROCESS_INFORMATION));
1081 prop = msi_dup_property( package, source );
1082 if (!prop)
1083 return ERROR_SUCCESS;
1085 deformat_string(package,target,&deformated);
1086 len = strlenW(prop) + 2;
1087 if (deformated)
1088 len += strlenW(deformated);
1090 cmd = msi_alloc(sizeof(WCHAR)*len);
1092 strcpyW(cmd,prop);
1093 if (deformated)
1095 strcatW(cmd,spc);
1096 strcatW(cmd,deformated);
1098 msi_free(deformated);
1100 msi_free(prop);
1102 TRACE("executing exe %s\n", debugstr_w(cmd));
1104 rc = CreateProcessW(NULL, cmd, NULL, NULL, FALSE, 0, NULL,
1105 c_collen, &si, &info);
1107 if ( !rc )
1109 ERR("Unable to execute command %s\n", debugstr_w(cmd));
1110 msi_free(cmd);
1111 return ERROR_SUCCESS;
1113 msi_free(cmd);
1115 CloseHandle( info.hThread );
1117 return wait_process_handle(package, type, info.hProcess, action);
1120 static UINT HANDLE_CustomType34(MSIPACKAGE *package, LPCWSTR source,
1121 LPCWSTR target, const INT type, LPCWSTR action)
1123 LPWSTR filename, deformated;
1124 STARTUPINFOW si;
1125 PROCESS_INFORMATION info;
1126 BOOL rc;
1128 memset(&si,0,sizeof(STARTUPINFOW));
1130 filename = resolve_folder(package, source, FALSE, FALSE, TRUE, NULL);
1132 if (!filename)
1133 return ERROR_FUNCTION_FAILED;
1135 SetCurrentDirectoryW(filename);
1136 msi_free(filename);
1138 deformat_string(package,target,&deformated);
1140 if (!deformated)
1141 return ERROR_FUNCTION_FAILED;
1143 TRACE("executing exe %s\n", debugstr_w(deformated));
1145 rc = CreateProcessW(NULL, deformated, NULL, NULL, FALSE, 0, NULL,
1146 c_collen, &si, &info);
1148 if ( !rc )
1150 ERR("Unable to execute command %s\n", debugstr_w(deformated));
1151 msi_free(deformated);
1152 return ERROR_SUCCESS;
1154 msi_free(deformated);
1155 CloseHandle( info.hThread );
1157 return wait_process_handle(package, type, info.hProcess, action);
1160 static DWORD ACTION_CallScript( const GUID *guid )
1162 msi_custom_action_info *info;
1163 MSIHANDLE hPackage;
1164 UINT r = ERROR_FUNCTION_FAILED;
1166 info = find_action_by_guid( guid );
1167 if (!info)
1169 ERR("failed to find action %s\n", debugstr_guid( guid) );
1170 return r;
1173 TRACE("function %s, script %s\n", debugstr_w( info->target ), debugstr_w( info->source ) );
1175 hPackage = alloc_msihandle( &info->package->hdr );
1176 if (hPackage)
1178 r = call_script( hPackage, info->type, info->source, info->target, info->action );
1179 MsiCloseHandle( hPackage );
1181 else
1182 ERR("failed to create handle for %p\n", info->package );
1184 release_custom_action_data( info );
1186 return S_OK;
1189 static DWORD WINAPI ScriptThread( LPVOID arg )
1191 LPGUID guid = arg;
1192 DWORD rc = 0;
1194 TRACE("custom action (%x) started\n", GetCurrentThreadId() );
1196 rc = ACTION_CallScript( guid );
1198 TRACE("custom action (%x) returned %i\n", GetCurrentThreadId(), rc );
1200 MsiCloseAllHandles();
1201 return rc;
1204 static msi_custom_action_info *do_msidbCustomActionTypeScript(
1205 MSIPACKAGE *package, INT type, LPCWSTR script, LPCWSTR function, LPCWSTR action )
1207 msi_custom_action_info *info;
1209 info = msi_alloc( sizeof *info );
1210 if (!info)
1211 return NULL;
1213 msiobj_addref( &package->hdr );
1214 info->refs = 2; /* 1 for our caller and 1 for thread we created */
1215 info->package = package;
1216 info->type = type;
1217 info->target = strdupW( function );
1218 info->source = strdupW( script );
1219 info->action = strdupW( action );
1220 CoCreateGuid( &info->guid );
1222 EnterCriticalSection( &msi_custom_action_cs );
1223 list_add_tail( &msi_pending_custom_actions, &info->entry );
1224 LeaveCriticalSection( &msi_custom_action_cs );
1226 info->handle = CreateThread( NULL, 0, ScriptThread, &info->guid, 0, NULL );
1227 if (!info->handle)
1229 /* release both references */
1230 release_custom_action_data( info );
1231 release_custom_action_data( info );
1232 return NULL;
1235 return info;
1238 static UINT HANDLE_CustomType37_38(MSIPACKAGE *package, LPCWSTR source,
1239 LPCWSTR target, const INT type, LPCWSTR action)
1241 UINT r;
1242 msi_custom_action_info *info;
1244 TRACE("%s %s\n", debugstr_w(source), debugstr_w(target));
1246 info = do_msidbCustomActionTypeScript( package, type, target, NULL, action );
1248 r = wait_thread_handle( info );
1249 release_custom_action_data( info );
1250 return r;
1253 static UINT HANDLE_CustomType5_6(MSIPACKAGE *package, LPCWSTR source,
1254 LPCWSTR target, const INT type, LPCWSTR action)
1256 static const WCHAR query[] = {
1257 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
1258 '`','B','i' ,'n','a','r','y','`',' ','W','H','E','R','E',' ',
1259 '`','N','a','m','e','`',' ','=',' ','\'','%','s','\'',0};
1260 MSIRECORD *row = 0;
1261 msi_custom_action_info *info;
1262 CHAR *buffer = NULL;
1263 WCHAR *bufferw = NULL;
1264 DWORD sz = 0;
1265 UINT r;
1267 TRACE("%s %s\n", debugstr_w(source), debugstr_w(target));
1269 row = MSI_QueryGetRecord(package->db, query, source);
1270 if (!row)
1271 return ERROR_FUNCTION_FAILED;
1273 r = MSI_RecordReadStream(row, 2, NULL, &sz);
1274 if (r != ERROR_SUCCESS)
1275 return r;
1277 buffer = msi_alloc(sizeof(CHAR)*(sz+1));
1278 if (!buffer)
1279 return ERROR_FUNCTION_FAILED;
1281 r = MSI_RecordReadStream(row, 2, buffer, &sz);
1282 if (r != ERROR_SUCCESS)
1283 goto done;
1285 buffer[sz] = 0;
1286 bufferw = strdupAtoW(buffer);
1287 if (!bufferw)
1289 r = ERROR_FUNCTION_FAILED;
1290 goto done;
1293 info = do_msidbCustomActionTypeScript( package, type, bufferw, target, action );
1294 r = wait_thread_handle( info );
1295 release_custom_action_data( info );
1297 done:
1298 msi_free(bufferw);
1299 msi_free(buffer);
1300 return r;
1303 static UINT HANDLE_CustomType21_22(MSIPACKAGE *package, LPCWSTR source,
1304 LPCWSTR target, const INT type, LPCWSTR action)
1306 msi_custom_action_info *info;
1307 MSIFILE *file;
1308 HANDLE hFile;
1309 DWORD sz, szHighWord = 0, read;
1310 CHAR *buffer=NULL;
1311 WCHAR *bufferw=NULL;
1312 BOOL bRet;
1313 UINT r;
1315 TRACE("%s %s\n", debugstr_w(source), debugstr_w(target));
1317 file = get_loaded_file(package,source);
1318 if (!file)
1320 ERR("invalid file key %s\n", debugstr_w(source));
1321 return ERROR_FUNCTION_FAILED;
1324 hFile = CreateFileW(file->TargetPath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
1325 if (hFile == INVALID_HANDLE_VALUE)
1326 return ERROR_FUNCTION_FAILED;
1328 sz = GetFileSize(hFile, &szHighWord);
1329 if (sz == INVALID_FILE_SIZE || szHighWord != 0)
1331 CloseHandle(hFile);
1332 return ERROR_FUNCTION_FAILED;
1335 buffer = msi_alloc(sizeof(CHAR)*(sz+1));
1336 if (!buffer)
1338 CloseHandle(hFile);
1339 return ERROR_FUNCTION_FAILED;
1342 bRet = ReadFile(hFile, buffer, sz, &read, NULL);
1343 CloseHandle(hFile);
1344 if (!bRet)
1346 r = ERROR_FUNCTION_FAILED;
1347 goto done;
1350 buffer[read] = 0;
1351 bufferw = strdupAtoW(buffer);
1352 if (!bufferw)
1354 r = ERROR_FUNCTION_FAILED;
1355 goto done;
1358 info = do_msidbCustomActionTypeScript( package, type, bufferw, target, action );
1359 r = wait_thread_handle( info );
1360 release_custom_action_data( info );
1362 done:
1363 msi_free(bufferw);
1364 msi_free(buffer);
1365 return r;
1368 static UINT HANDLE_CustomType53_54(MSIPACKAGE *package, LPCWSTR source,
1369 LPCWSTR target, const INT type, LPCWSTR action)
1371 msi_custom_action_info *info;
1372 WCHAR *prop;
1373 UINT r;
1375 TRACE("%s %s\n", debugstr_w(source), debugstr_w(target));
1377 prop = msi_dup_property(package,source);
1378 if (!prop)
1379 return ERROR_SUCCESS;
1381 info = do_msidbCustomActionTypeScript( package, type, prop, NULL, action );
1382 msi_free(prop);
1383 r = wait_thread_handle( info );
1384 release_custom_action_data( info );
1385 return r;
1388 void ACTION_FinishCustomActions(const MSIPACKAGE* package)
1390 struct list *item;
1391 HANDLE *wait_handles;
1392 unsigned int handle_count, i;
1393 msi_custom_action_info *info, *cursor;
1395 while ((item = list_head( &package->RunningActions )))
1397 MSIRUNNINGACTION *action = LIST_ENTRY( item, MSIRUNNINGACTION, entry );
1399 list_remove( &action->entry );
1401 TRACE("waiting for %s\n", debugstr_w( action->name ) );
1402 msi_dialog_check_messages( action->handle );
1404 CloseHandle( action->handle );
1405 msi_free( action->name );
1406 msi_free( action );
1409 EnterCriticalSection( &msi_custom_action_cs );
1411 handle_count = list_count( &msi_pending_custom_actions );
1412 wait_handles = HeapAlloc( GetProcessHeap(), 0, handle_count * sizeof(HANDLE) );
1414 handle_count = 0;
1415 LIST_FOR_EACH_ENTRY_SAFE( info, cursor, &msi_pending_custom_actions, msi_custom_action_info, entry )
1417 if (info->package == package )
1419 if (DuplicateHandle(GetCurrentProcess(), info->handle, GetCurrentProcess(), &wait_handles[handle_count], SYNCHRONIZE, FALSE, 0))
1420 handle_count++;
1424 LeaveCriticalSection( &msi_custom_action_cs );
1426 for (i = 0; i < handle_count; i++)
1428 msi_dialog_check_messages( wait_handles[i] );
1429 CloseHandle( wait_handles[i] );
1432 HeapFree( GetProcessHeap(), 0, wait_handles );
1435 typedef struct _msi_custom_remote_impl {
1436 const IWineMsiRemoteCustomActionVtbl *lpVtbl;
1437 LONG refs;
1438 } msi_custom_remote_impl;
1440 static inline msi_custom_remote_impl* mcr_from_IWineMsiRemoteCustomAction( IWineMsiRemoteCustomAction* iface )
1442 return (msi_custom_remote_impl*) iface;
1445 static HRESULT WINAPI mcr_QueryInterface( IWineMsiRemoteCustomAction *iface,
1446 REFIID riid,LPVOID *ppobj)
1448 if( IsEqualCLSID( riid, &IID_IUnknown ) ||
1449 IsEqualCLSID( riid, &IID_IWineMsiRemoteCustomAction ) )
1451 IUnknown_AddRef( iface );
1452 *ppobj = iface;
1453 return S_OK;
1456 return E_NOINTERFACE;
1459 static ULONG WINAPI mcr_AddRef( IWineMsiRemoteCustomAction *iface )
1461 msi_custom_remote_impl* This = mcr_from_IWineMsiRemoteCustomAction( iface );
1463 return InterlockedIncrement( &This->refs );
1466 static ULONG WINAPI mcr_Release( IWineMsiRemoteCustomAction *iface )
1468 msi_custom_remote_impl* This = mcr_from_IWineMsiRemoteCustomAction( iface );
1469 ULONG r;
1471 r = InterlockedDecrement( &This->refs );
1472 if (r == 0)
1473 msi_free( This );
1474 return r;
1477 static HRESULT WINAPI mcr_GetActionInfo( IWineMsiRemoteCustomAction *iface, LPCGUID custom_action_guid,
1478 INT *type, MSIHANDLE *handle, BSTR *dll, BSTR *func, IWineMsiRemotePackage **remote_package )
1480 msi_custom_action_info *info;
1482 info = find_action_by_guid( custom_action_guid );
1483 if (!info)
1484 return E_FAIL;
1486 *type = info->type;
1487 *handle = alloc_msihandle( &info->package->hdr );
1488 *dll = SysAllocString( info->source );
1489 *func = SysAllocString( info->target );
1491 release_custom_action_data( info );
1492 return create_msi_remote_package( NULL, (LPVOID *)remote_package );
1495 static const IWineMsiRemoteCustomActionVtbl msi_custom_remote_vtbl =
1497 mcr_QueryInterface,
1498 mcr_AddRef,
1499 mcr_Release,
1500 mcr_GetActionInfo,
1503 HRESULT create_msi_custom_remote( IUnknown *pOuter, LPVOID *ppObj )
1505 msi_custom_remote_impl* This;
1507 This = msi_alloc( sizeof *This );
1508 if (!This)
1509 return E_OUTOFMEMORY;
1511 This->lpVtbl = &msi_custom_remote_vtbl;
1512 This->refs = 1;
1514 *ppObj = This;
1516 return S_OK;