ReactOS  0.4.15-dev-321-g2d9b385
custom.c File Reference
#include "config.h"
#include "wine/port.h"
#include "wine/asm.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "msidefs.h"
#include "winuser.h"
#include "objbase.h"
#include "oleauto.h"
#include "msipriv.h"
#include "msiserver.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "wine/exception.h"
Include dependency graph for custom.c:

Go to the source code of this file.

Classes

struct  tagMSIRUNNINGACTION
 
struct  _msi_custom_action_info
 
struct  _msi_custom_remote_impl
 

Macros

#define COBJMACROS
 
#define CUSTOM_ACTION_TYPE_MASK   0x3F
 

Typedefs

typedef struct tagMSIRUNNINGACTION MSIRUNNINGACTION
 
typedef UINT(WINAPIMsiCustomActionEntryPoint) (MSIHANDLE)
 
typedef struct _msi_custom_action_info msi_custom_action_info
 
typedef struct _msi_custom_remote_impl msi_custom_remote_impl
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (msi)
 
UINT msi_schedule_action (MSIPACKAGE *package, UINT script, const WCHAR *action)
 
UINT msi_register_unique_action (MSIPACKAGE *package, const WCHAR *action)
 
BOOL msi_action_is_unique (const MSIPACKAGE *package, const WCHAR *action)
 
static BOOL check_execution_scheduling_options (MSIPACKAGE *package, LPCWSTR action, UINT options)
 
static LPWSTR msi_get_deferred_action (LPCWSTR action, LPCWSTR actiondata, LPCWSTR usersid, LPCWSTR prodcode)
 
static void set_deferred_action_props (MSIPACKAGE *package, const WCHAR *deferred_data)
 
WCHARmsi_create_temp_file (MSIDATABASE *db)
 
static MSIBINARYcreate_temp_binary (MSIPACKAGE *package, LPCWSTR source, BOOL dll)
 
static MSIBINARYget_temp_binary (MSIPACKAGE *package, LPCWSTR source, BOOL dll)
 
static void file_running_action (MSIPACKAGE *package, HANDLE Handle, BOOL process, LPCWSTR name)
 
static UINT custom_get_process_return (HANDLE process)
 
static UINT custom_get_thread_return (MSIPACKAGE *package, HANDLE thread)
 
static UINT wait_process_handle (MSIPACKAGE *package, UINT type, HANDLE ProcessHandle, LPCWSTR name)
 
static void release_custom_action_data (msi_custom_action_info *info)
 
static void addref_custom_action_data (msi_custom_action_info *info)
 
static UINT wait_thread_handle (msi_custom_action_info *info)
 
static msi_custom_action_infofind_action_by_guid (const GUID *guid)
 
static void handle_msi_break (LPCWSTR target)
 
static UINT get_action_info (const GUID *guid, INT *type, MSIHANDLE *handle, BSTR *dll, BSTR *funcname, IWineMsiRemotePackage **package)
 
static UINT CUSTOMPROC_wrapper (MsiCustomActionEntryPoint proc, MSIHANDLE handle)
 
static DWORD ACTION_CallDllFunction (const GUID *guid)
 
static DWORD WINAPI DllThread (LPVOID arg)
 
static msi_custom_action_infodo_msidbCustomActionTypeDll (MSIPACKAGE *package, INT type, LPCWSTR source, LPCWSTR target, LPCWSTR action)
 
static UINT HANDLE_CustomType1 (MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
 
static HANDLE execute_command (const WCHAR *app, WCHAR *arg, const WCHAR *dir)
 
static UINT HANDLE_CustomType2 (MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
 
static UINT HANDLE_CustomType17 (MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
 
static UINT HANDLE_CustomType18 (MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
 
static UINT HANDLE_CustomType19 (MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
 
static UINT HANDLE_CustomType23 (MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
 
static UINT HANDLE_CustomType50 (MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
 
static UINT HANDLE_CustomType34 (MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
 
static DWORD ACTION_CallScript (const GUID *guid)
 
static DWORD WINAPI ScriptThread (LPVOID arg)
 
static msi_custom_action_infodo_msidbCustomActionTypeScript (MSIPACKAGE *package, INT type, LPCWSTR script, LPCWSTR function, LPCWSTR action)
 
static UINT HANDLE_CustomType37_38 (MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
 
static UINT HANDLE_CustomType5_6 (MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
 
static UINT HANDLE_CustomType21_22 (MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
 
static UINT HANDLE_CustomType53_54 (MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
 
static BOOL action_type_matches_script (UINT type, UINT script)
 
static UINT defer_custom_action (MSIPACKAGE *package, const WCHAR *action, UINT type)
 
UINT ACTION_CustomAction (MSIPACKAGE *package, LPCWSTR action, UINT script)
 
void ACTION_FinishCustomActions (const MSIPACKAGE *package)
 
static msi_custom_remote_implimpl_from_IWineMsiRemoteCustomAction (IWineMsiRemoteCustomAction *iface)
 
static HRESULT WINAPI mcr_QueryInterface (IWineMsiRemoteCustomAction *iface, REFIID riid, LPVOID *ppobj)
 
static ULONG WINAPI mcr_AddRef (IWineMsiRemoteCustomAction *iface)
 
static ULONG WINAPI mcr_Release (IWineMsiRemoteCustomAction *iface)
 
static HRESULT WINAPI mcr_GetActionInfo (IWineMsiRemoteCustomAction *iface, LPCGUID custom_action_guid, INT *type, MSIHANDLE *handle, BSTR *dll, BSTR *func, IWineMsiRemotePackage **remote_package)
 
HRESULT create_msi_custom_remote (IUnknown *pOuter, LPVOID *ppObj)
 

Variables

static CRITICAL_SECTION msi_custom_action_cs = { &msi_custom_action_cs_debug, -1, 0, 0, 0, 0 }
 
static CRITICAL_SECTION_DEBUG msi_custom_action_cs_debug
 
static struct list msi_pending_custom_actions = LIST_INIT( msi_pending_custom_actions )
 
static const IWineMsiRemoteCustomActionVtbl msi_custom_remote_vtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 25 of file custom.c.

◆ CUSTOM_ACTION_TYPE_MASK

#define CUSTOM_ACTION_TYPE_MASK   0x3F

Definition at line 48 of file custom.c.

Typedef Documentation

◆ msi_custom_action_info

◆ msi_custom_remote_impl

◆ MsiCustomActionEntryPoint

typedef UINT(WINAPI * MsiCustomActionEntryPoint) (MSIHANDLE)

Definition at line 58 of file custom.c.

◆ MSIRUNNINGACTION

Function Documentation

◆ ACTION_CallDllFunction()

static DWORD ACTION_CallDllFunction ( const GUID guid)
static

Definition at line 555 of file custom.c.

556 {
558  MSIHANDLE hPackage, handle;
559  HANDLE hModule;
560  LPSTR proc;
562  BSTR dll = NULL, function = NULL;
563  INT type;
564  IWineMsiRemotePackage *remote_package = NULL;
565 
566  TRACE("%s\n", debugstr_guid( guid ));
567 
568  r = get_action_info( guid, &type, &handle, &dll, &function, &remote_package );
569  if (r != ERROR_SUCCESS)
570  return r;
571 
572  hModule = LoadLibraryW( dll );
573  if (!hModule)
574  {
575  ERR( "failed to load dll %s (%u)\n", debugstr_w( dll ), GetLastError() );
576  return ERROR_SUCCESS;
577  }
578 
579  proc = strdupWtoA( function );
581  msi_free( proc );
582  if (fn)
583  {
584  hPackage = alloc_msi_remote_handle( (IUnknown *)remote_package );
585  if (hPackage)
586  {
587  IWineMsiRemotePackage_SetMsiHandle( remote_package, handle );
588  TRACE("calling %s\n", debugstr_w( function ) );
589  handle_msi_break( function );
590 
591  __TRY
592  {
593  r = CUSTOMPROC_wrapper( fn, hPackage );
594  }
596  {
597  ERR("Custom action (%s:%s) caused a page fault: %08x\n",
598  debugstr_w(dll), debugstr_w(function), GetExceptionCode());
599  r = ERROR_SUCCESS;
600  }
601  __ENDTRY;
602 
603  MsiCloseHandle( hPackage );
604  }
605  else
606  ERR("failed to create handle for %p\n", remote_package );
607  }
608  else
609  ERR("GetProcAddress(%s) failed\n", debugstr_w( function ) );
610 
612 
613  IWineMsiRemotePackage_Release( remote_package );
614  SysFreeString( dll );
615  SysFreeString( function );
617 
618  return r;
619 }
static UINT CUSTOMPROC_wrapper(MsiCustomActionEntryPoint proc, MSIHANDLE handle)
Definition: custom.c:549
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
static void handle_msi_break(LPCWSTR target)
Definition: custom.c:464
#define ERROR_SUCCESS
Definition: deptool.c:10
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static LPSTR strdupWtoA(LPCWSTR str)
Definition: hhctrl.h:296
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static HANDLE proc()
Definition: pdb.c:32
OLECHAR * BSTR
Definition: compat.h:1943
char * LPSTR
Definition: xmlstorage.h:182
int32_t INT
Definition: typedefs.h:57
unsigned long MSIHANDLE
Definition: msiserver.idl:25
UINT(WINAPI * MsiCustomActionEntryPoint)(MSIHANDLE)
Definition: custom.c:58
static HMODULE dll
Definition: str.c:188
const GUID * guid
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define debugstr_w
Definition: kernel32.h:32
#define LoadLibraryW(x)
Definition: compat.h:413
smooth NULL
Definition: ftsmooth.c:416
MSIHANDLE alloc_msi_remote_handle(IUnknown *unk)
Definition: handle.c:133
#define __TRY
Definition: compat.h:70
#define debugstr_guid
Definition: kernel32.h:35
#define GetExceptionCode()
Definition: exception.h:69
#define TRACE(s)
Definition: solgame.cpp:4
#define FreeLibrary(x)
Definition: compat.h:414
#define __ENDTRY
Definition: compat.h:72
static UINT get_action_info(const GUID *guid, INT *type, MSIHANDLE *handle, BSTR *dll, BSTR *funcname, IWineMsiRemotePackage **package)
Definition: custom.c:498
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
#define ERR(fmt,...)
Definition: debug.h:110
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
unsigned int UINT
Definition: ndis.h:50
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
#define GetProcAddress(x, y)
Definition: compat.h:419
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71
HMODULE hModule
Definition: animate.c:44

Referenced by DllThread().

◆ ACTION_CallScript()

static DWORD ACTION_CallScript ( const GUID guid)
static

Definition at line 924 of file custom.c.

925 {
927  MSIHANDLE hPackage;
929 
931  if (!info)
932  {
933  ERR("failed to find action %s\n", debugstr_guid( guid) );
934  return ERROR_FUNCTION_FAILED;
935  }
936 
937  TRACE("function %s, script %s\n", debugstr_w( info->target ), debugstr_w( info->source ) );
938 
939  hPackage = alloc_msihandle( &info->package->hdr );
940  if (hPackage)
941  {
942  r = call_script( hPackage, info->type, info->source, info->target, info->action );
943  TRACE("script returned %u\n", r);
944  MsiCloseHandle( hPackage );
945  }
946  else
947  ERR("failed to create handle for %p\n", info->package );
948 
950  return r;
951 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
unsigned long MSIHANDLE
Definition: msiserver.idl:25
struct _test_info info[]
Definition: SetCursorPos.c:19
const GUID * guid
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define debugstr_w
Definition: kernel32.h:32
DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR function, LPCWSTR action) DECLSPEC_HIDDEN
Definition: script.c:293
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
#define ERR(fmt,...)
Definition: debug.h:110
MSIHANDLE alloc_msihandle(MSIOBJECTHDR *obj)
Definition: handle.c:109
unsigned int UINT
Definition: ndis.h:50
static msi_custom_action_info * find_action_by_guid(const GUID *guid)
Definition: custom.c:439
static void release_custom_action_data(msi_custom_action_info *info)
Definition: custom.c:391

Referenced by ScriptThread().

◆ ACTION_CustomAction()

UINT ACTION_CustomAction ( MSIPACKAGE package,
LPCWSTR  action,
UINT  script 
)

Definition at line 1194 of file custom.c.

1195 {
1196  static const WCHAR query[] = {
1197  'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
1198  '`','C','u','s','t','o','m','A','c','t','i','o','n','`',' ','W','H','E','R','E',' ',
1199  '`','A','c','t','i' ,'o','n','`',' ','=',' ','\'','%','s','\'',0};
1200  UINT rc = ERROR_SUCCESS;
1201  MSIRECORD *row;
1202  UINT type;
1203  const WCHAR *source, *target, *ptr, *deferred_data = NULL;
1204  WCHAR *deformated = NULL;
1205  int len;
1206 
1207  /* deferred action: [properties]Action */
1208  if ((ptr = strrchrW(action, ']')))
1209  {
1210  deferred_data = action;
1211  action = ptr + 1;
1212  }
1213 
1214  row = MSI_QueryGetRecord( package->db, query, action );
1215  if (!row)
1217 
1221 
1222  TRACE("Handling custom action %s (%x %s %s)\n",debugstr_w(action),type,
1224 
1225  /* handle some of the deferred actions */
1227  FIXME("msidbCustomActionTypeTSAware not handled\n");
1228 
1230  {
1232  WARN("msidbCustomActionTypeNoImpersonate not handled\n");
1233 
1235  {
1236  rc = defer_custom_action( package, action, type );
1237  goto end;
1238  }
1239  else
1240  {
1241  LPWSTR actiondata = msi_dup_property( package->db, action );
1242 
1244  package->scheduled_action_running = TRUE;
1245 
1247  package->commit_action_running = TRUE;
1248 
1250  package->rollback_action_running = TRUE;
1251 
1252  if (deferred_data)
1253  set_deferred_action_props(package, deferred_data);
1254  else if (actiondata)
1255  msi_set_property( package->db, szCustomActionData, actiondata, -1 );
1256  else
1257  msi_set_property( package->db, szCustomActionData, szEmpty, -1 );
1258 
1259  msi_free(actiondata);
1260  }
1261  }
1262  else if (!check_execution_scheduling_options(package,action,type))
1263  {
1264  rc = ERROR_SUCCESS;
1265  goto end;
1266  }
1267 
1268  switch (type & CUSTOM_ACTION_TYPE_MASK)
1269  {
1270  case 1: /* DLL file stored in a Binary table stream */
1271  rc = HANDLE_CustomType1(package,source,target,type,action);
1272  break;
1273  case 2: /* EXE file stored in a Binary table stream */
1274  rc = HANDLE_CustomType2(package,source,target,type,action);
1275  break;
1276  case 18: /*EXE file installed with package */
1278  break;
1279  case 19: /* Error that halts install */
1281  break;
1282  case 17:
1284  break;
1285  case 23: /* installs another package in the source tree */
1286  deformat_string(package,target,&deformated);
1287  rc = HANDLE_CustomType23(package,source,deformated,type,action);
1288  msi_free(deformated);
1289  break;
1290  case 50: /*EXE file specified by a property value */
1292  break;
1293  case 34: /*EXE to be run in specified directory */
1295  break;
1296  case 35: /* Directory set with formatted text. */
1297  deformat_string(package,target,&deformated);
1298  MSI_SetTargetPathW(package, source, deformated);
1299  msi_free(deformated);
1300  break;
1301  case 51: /* Property set with formatted text. */
1302  if (!source)
1303  break;
1304 
1305  len = deformat_string( package, target, &deformated );
1306  rc = msi_set_property( package->db, source, deformated, len );
1307  if (rc == ERROR_SUCCESS && !strcmpW( source, szSourceDir ))
1308  msi_reset_folders( package, TRUE );
1309  msi_free(deformated);
1310  break;
1311  case 37: /* JScript/VBScript text stored in target column. */
1312  case 38:
1314  break;
1315  case 5:
1316  case 6: /* JScript/VBScript file stored in a Binary table stream. */
1318  break;
1319  case 21: /* JScript/VBScript file installed with the product. */
1320  case 22:
1322  break;
1323  case 53: /* JScript/VBScript text specified by a property value. */
1324  case 54:
1326  break;
1327  default:
1328  FIXME("unhandled action type %u (%s %s)\n", type & CUSTOM_ACTION_TYPE_MASK,
1330  }
1331 
1332 end:
1333  package->scheduled_action_running = FALSE;
1334  package->commit_action_running = FALSE;
1335  package->rollback_action_running = FALSE;
1336  msiobj_release(&row->hdr);
1337  return rc;
1338 }
static UINT HANDLE_CustomType17(MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
Definition: custom.c:771
static BOOL check_execution_scheduling_options(MSIPACKAGE *package, LPCWSTR action, UINT options)
Definition: custom.c:124
static UINT HANDLE_CustomType18(MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
Definition: custom.c:790
#define CUSTOM_ACTION_TYPE_MASK
Definition: custom.c:48
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
static UINT HANDLE_CustomType53_54(MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
Definition: custom.c:1124
#define WARN(fmt,...)
Definition: debug.h:112
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
static UINT HANDLE_CustomType1(MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
Definition: custom.c:670
static UINT HANDLE_CustomType19(MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
Definition: custom.c:808
static UINT HANDLE_CustomType34(MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
Definition: custom.c:901
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
static PVOID ptr
Definition: dispmode.c:27
unsigned char rollback_action_running
Definition: msipriv.h:446
#define ERROR_FUNCTION_NOT_CALLED
Definition: winerror.h:984
smooth NULL
Definition: ftsmooth.c:416
void msi_reset_folders(MSIPACKAGE *package, BOOL source) DECLSPEC_HIDDEN
Definition: package.c:2130
script
Definition: msipriv.h:374
const WCHAR * MSI_RecordGetString(const MSIRECORD *, UINT) DECLSPEC_HIDDEN
Definition: record.c:482
static void set_deferred_action_props(MSIPACKAGE *package, const WCHAR *deferred_data)
Definition: custom.c:185
static UINT HANDLE_CustomType50(MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
Definition: custom.c:883
unsigned char commit_action_running
Definition: msipriv.h:445
static const WCHAR szEmpty[]
Definition: provider.c:50
DWORD deformat_string(MSIPACKAGE *package, const WCHAR *fmt, WCHAR **data)
Definition: format.c:1016
#define TRACE(s)
Definition: solgame.cpp:4
UINT MSI_SetTargetPathW(MSIPACKAGE *package, LPCWSTR szFolder, LPCWSTR szFolderPath)
Definition: install.c:567
__wchar_t WCHAR
Definition: xmlstorage.h:180
MSIRECORD * MSI_QueryGetRecord(MSIDATABASE *db, LPCWSTR query,...) DECLSPEC_HIDDEN
Definition: msiquery.c:206
MSIDATABASE * db
Definition: msipriv.h:386
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:242
static UINT HANDLE_CustomType2(MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
Definition: custom.c:753
static const WCHAR szSourceDir[]
Definition: msipriv.h:1100
static UINT defer_custom_action(MSIPACKAGE *package, const WCHAR *action, UINT type)
Definition: custom.c:1157
static UINT HANDLE_CustomType5_6(MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
Definition: custom.c:1013
GLenum GLsizei len
Definition: glext.h:6722
unsigned char scheduled_action_running
Definition: msipriv.h:444
static UINT HANDLE_CustomType23(MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
Definition: custom.c:839
WINE_UNICODE_INLINE WCHAR * strrchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:254
int MSI_RecordGetInteger(MSIRECORD *, UINT) DECLSPEC_HIDDEN
Definition: record.c:245
const WCHAR * action
Definition: action.c:7783
GLsizei GLsizei GLchar * source
Definition: glext.h:6048
unsigned int UINT
Definition: ndis.h:50
UINT msi_set_property(MSIDATABASE *, const WCHAR *, const WCHAR *, int) DECLSPEC_HIDDEN
Definition: package.c:2149
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
static BOOL action_type_matches_script(UINT type, UINT script)
Definition: custom.c:1140
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229
GLenum target
Definition: glext.h:7315
static UINT HANDLE_CustomType21_22(MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
Definition: custom.c:1065
static UINT HANDLE_CustomType37_38(MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
Definition: custom.c:1002
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static const WCHAR szCustomActionData[]
Definition: msipriv.h:1139
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
LPWSTR msi_dup_property(MSIDATABASE *db, LPCWSTR prop) DECLSPEC_HIDDEN
Definition: package.c:2370

Referenced by ACTION_HandleCustomAction().

◆ ACTION_FinishCustomActions()

void ACTION_FinishCustomActions ( const MSIPACKAGE package)

Definition at line 1340 of file custom.c.

1341 {
1342  struct list *item;
1343  HANDLE *wait_handles;
1344  unsigned int handle_count, i;
1346 
1347  while ((item = list_head( &package->RunningActions )))
1348  {
1350 
1351  list_remove( &action->entry );
1352 
1353  TRACE("waiting for %s\n", debugstr_w( action->name ) );
1354  msi_dialog_check_messages( action->handle );
1355 
1356  CloseHandle( action->handle );
1357  msi_free( action->name );
1358  msi_free( action );
1359  }
1360 
1362 
1363  handle_count = list_count( &msi_pending_custom_actions );
1364  wait_handles = msi_alloc( handle_count * sizeof(HANDLE) );
1365 
1366  handle_count = 0;
1368  {
1369  if (info->package == package )
1370  {
1371  if (DuplicateHandle(GetCurrentProcess(), info->handle, GetCurrentProcess(), &wait_handles[handle_count], SYNCHRONIZE, FALSE, 0))
1372  handle_count++;
1373  }
1374  }
1375 
1377 
1378  for (i = 0; i < handle_count; i++)
1379  {
1380  msi_dialog_check_messages( wait_handles[i] );
1381  CloseHandle( wait_handles[i] );
1382  }
1383  msi_free( wait_handles );
1384 
1387  {
1388  if (info->package == package) release_custom_action_data( info );
1389  }
1391 }
#define CloseHandle
Definition: compat.h:407
struct list RunningActions
Definition: msipriv.h:422
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
Definition: list.h:131
struct _test_info info[]
Definition: SetCursorPos.c:19
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
__WINE_SERVER_LIST_INLINE unsigned int list_count(const struct list *list)
Definition: list.h:155
#define debugstr_w
Definition: kernel32.h:32
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define TRACE(s)
Definition: solgame.cpp:4
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1138
static CRITICAL_SECTION msi_custom_action_cs
Definition: custom.c:60
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228
#define SYNCHRONIZE
Definition: nt_native.h:61
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
const WCHAR * action
Definition: action.c:7783
static ATOM item
Definition: dde.c:856
const char cursor[]
Definition: icontest.c:13
static struct list msi_pending_custom_actions
Definition: custom.c:70
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define LIST_ENTRY(type)
Definition: queue.h:175
static void release_custom_action_data(msi_custom_action_info *info)
Definition: custom.c:391
BOOL WINAPI DuplicateHandle(IN HANDLE hSourceProcessHandle, IN HANDLE hSourceHandle, IN HANDLE hTargetProcessHandle, OUT LPHANDLE lpTargetHandle, IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwOptions)
Definition: handle.c:149
void msi_dialog_check_messages(HANDLE handle)
Definition: dialog.c:3979

Referenced by MSI_InstallPackage().

◆ action_type_matches_script()

static BOOL action_type_matches_script ( UINT  type,
UINT  script 
)
static

Definition at line 1140 of file custom.c.

1141 {
1142  switch (script)
1143  {
1144  case SCRIPT_NONE:
1145  case SCRIPT_INSTALL:
1147  case SCRIPT_COMMIT:
1148  return (type & msidbCustomActionTypeCommit);
1149  case SCRIPT_ROLLBACK:
1151  default:
1152  ERR("unhandled script %u\n", script);
1153  }
1154  return FALSE;
1155 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
script
Definition: msipriv.h:374
#define ERR(fmt,...)
Definition: debug.h:110

Referenced by ACTION_CustomAction().

◆ addref_custom_action_data()

static void addref_custom_action_data ( msi_custom_action_info info)
static

Definition at line 411 of file custom.c.

412 {
413  info->refs++;
414  }

Referenced by find_action_by_guid().

◆ check_execution_scheduling_options()

static BOOL check_execution_scheduling_options ( MSIPACKAGE package,
LPCWSTR  action,
UINT  options 
)
static

Definition at line 124 of file custom.c.

125 {
128  {
129  if (!(package->InWhatSequence & SEQUENCE_UI &&
130  package->InWhatSequence & SEQUENCE_EXEC))
131  {
132  TRACE("Skipping action due to dbCustomActionTypeClientRepeat option.\n");
133  return FALSE;
134  }
135  }
137  {
138  if (package->InWhatSequence & SEQUENCE_UI &&
139  package->InWhatSequence & SEQUENCE_EXEC )
140  {
141  TRACE("Skipping action due to msidbCustomActionTypeFirstSequence option.\n");
142  return FALSE;
143  }
144  }
146  {
147  if (msi_action_is_unique(package, action))
148  {
149  TRACE("Skipping action due to msidbCustomActionTypeOncePerProcess option.\n");
150  return FALSE;
151  }
152  else
154  }
155 
156  return TRUE;
157 }
#define TRUE
Definition: types.h:120
BOOL msi_action_is_unique(const MSIPACKAGE *package, const WCHAR *action)
Definition: custom.c:113
#define SEQUENCE_EXEC
Definition: msipriv.h:696
#define TRACE(s)
Definition: solgame.cpp:4
UINT InWhatSequence
Definition: msipriv.h:420
const WCHAR * action
Definition: action.c:7783
#define SEQUENCE_UI
Definition: msipriv.h:695
UINT msi_register_unique_action(MSIPACKAGE *package, const WCHAR *action)
Definition: custom.c:95

Referenced by ACTION_CustomAction().

◆ create_msi_custom_remote()

HRESULT create_msi_custom_remote ( IUnknown pOuter,
LPVOID ppObj 
)

Definition at line 1461 of file custom.c.

1462 {
1464 
1465  This = msi_alloc( sizeof *This );
1466  if (!This)
1467  return E_OUTOFMEMORY;
1468 
1469  This->IWineMsiRemoteCustomAction_iface.lpVtbl = &msi_custom_remote_vtbl;
1470  This->refs = 1;
1471 
1472  *ppObj = &This->IWineMsiRemoteCustomAction_iface;
1473 
1474  return S_OK;
1475 }
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static const IWineMsiRemoteCustomActionVtbl msi_custom_remote_vtbl
Definition: custom.c:1453
#define S_OK
Definition: intsafe.h:59
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204

◆ create_temp_binary()

static MSIBINARY* create_temp_binary ( MSIPACKAGE package,
LPCWSTR  source,
BOOL  dll 
)
static

Definition at line 231 of file custom.c.

232 {
233  static const WCHAR query[] = {
234  'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
235  '`','B','i' ,'n','a','r','y','`',' ','W','H','E','R','E',' ',
236  '`','N','a','m','e','`',' ','=',' ','\'','%','s','\'',0};
237  MSIRECORD *row;
238  MSIBINARY *binary = NULL;
239  HANDLE file;
240  CHAR buffer[1024];
241  WCHAR *tmpfile;
242  DWORD sz, write;
243  UINT r;
244 
245  if (!(tmpfile = msi_create_temp_file( package->db ))) return NULL;
246 
247  if (!(row = MSI_QueryGetRecord( package->db, query, source ))) goto error;
248  if (!(binary = msi_alloc_zero( sizeof(MSIBINARY) ))) goto error;
249 
251  if (file == INVALID_HANDLE_VALUE) goto error;
252 
253  do
254  {
255  sz = sizeof(buffer);
256  r = MSI_RecordReadStream( row, 2, buffer, &sz );
257  if (r != ERROR_SUCCESS)
258  {
259  ERR("Failed to get stream\n");
260  break;
261  }
262  WriteFile( file, buffer, sz, &write, NULL );
263  } while (sz == sizeof buffer);
264 
265  CloseHandle( file );
266  if (r != ERROR_SUCCESS) goto error;
267 
268  /* keep a reference to prevent the dll from being unloaded */
269  if (dll && !(binary->module = LoadLibraryW( tmpfile )))
270  {
271  ERR( "failed to load dll %s (%u)\n", debugstr_w( tmpfile ), GetLastError() );
272  }
273  binary->source = strdupW( source );
274  binary->tmpfile = tmpfile;
275  list_add_tail( &package->binaries, &binary->entry );
276 
277  msiobj_release( &row->hdr );
278  return binary;
279 
280 error:
281  if (row) msiobj_release( &row->hdr );
282  DeleteFileW( tmpfile );
283  msi_free( tmpfile );
284  msi_free( binary );
285  return NULL;
286 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
#define CloseHandle
Definition: compat.h:407
#define ERROR_SUCCESS
Definition: deptool.c:10
#define error(str)
Definition: mkdosfs.c:1605
static WCHAR * strdupW(const WCHAR *src)
Definition: main.c:92
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
char CHAR
Definition: xmlstorage.h:175
#define INVALID_HANDLE_VALUE
Definition: compat.h:400
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
static void * msi_alloc_zero(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1210
static HMODULE dll
Definition: str.c:188
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
#define write
Definition: acwin.h:97
#define GENERIC_WRITE
Definition: nt_native.h:90
#define debugstr_w
Definition: kernel32.h:32
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
#define LoadLibraryW(x)
Definition: compat.h:413
smooth NULL
Definition: ftsmooth.c:416
struct list binaries
Definition: msipriv.h:398
#define OPEN_EXISTING
Definition: compat.h:435
_Check_return_ _CRTIMP FILE *__cdecl tmpfile(void)
Definition: file.c:3912
__wchar_t WCHAR
Definition: xmlstorage.h:180
MSIRECORD * MSI_QueryGetRecord(MSIDATABASE *db, LPCWSTR query,...) DECLSPEC_HIDDEN
Definition: msiquery.c:206
const char file[]
Definition: icontest.c:11
unsigned long DWORD
Definition: ntddk_ex.h:95
MSIDATABASE * db
Definition: msipriv.h:386
const GLuint GLenum const GLvoid * binary
Definition: glext.h:7538
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:242
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define ERR(fmt,...)
Definition: debug.h:110
unsigned int UINT
Definition: ndis.h:50
#define CreateFileW
Definition: compat.h:409
UINT MSI_RecordReadStream(MSIRECORD *, UINT, char *, LPDWORD) DECLSPEC_HIDDEN
Definition: record.c:814
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
WCHAR * msi_create_temp_file(MSIDATABASE *db)
Definition: custom.c:202
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
Definition: fci.c:126

Referenced by get_temp_binary().

◆ custom_get_process_return()

static UINT custom_get_process_return ( HANDLE  process)
static

Definition at line 315 of file custom.c.

316 {
317  DWORD rc = 0;
318 
319  GetExitCodeProcess( process, &rc );
320  TRACE("exit code is %u\n", rc);
321  if (rc != 0)
322  return ERROR_FUNCTION_FAILED;
323  return ERROR_SUCCESS;
324 }
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL WINAPI GetExitCodeProcess(IN HANDLE hProcess, IN LPDWORD lpExitCode)
Definition: proc.c:1168
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95

Referenced by wait_process_handle().

◆ custom_get_thread_return()

static UINT custom_get_thread_return ( MSIPACKAGE package,
HANDLE  thread 
)
static

Definition at line 326 of file custom.c.

327 {
328  DWORD rc = 0;
329 
330  GetExitCodeThread( thread, &rc );
331 
332  switch (rc)
333  {
335  case ERROR_SUCCESS:
338  return rc;
339  case ERROR_NO_MORE_ITEMS:
340  return ERROR_SUCCESS;
342  ACTION_ForceReboot( package );
343  return ERROR_SUCCESS;
344  default:
345  ERR("Invalid Return Code %d\n",rc);
346  return ERROR_INSTALL_FAILURE;
347  }
348 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
UINT ACTION_ForceReboot(MSIPACKAGE *package)
Definition: action.c:5407
BOOL WINAPI GetExitCodeThread(IN HANDLE hThread, OUT LPDWORD lpExitCode)
Definition: thread.c:540
#define ERROR_FUNCTION_NOT_CALLED
Definition: winerror.h:984
#define ERROR_INSTALL_USEREXIT
Definition: winerror.h:960
#define ERROR_INSTALL_FAILURE
Definition: winerror.h:961
unsigned long DWORD
Definition: ntddk_ex.h:95
static HANDLE thread
Definition: service.c:33
#define ERR(fmt,...)
Definition: debug.h:110
#define ERROR_INSTALL_SUSPEND
Definition: winerror.h:962

Referenced by wait_thread_handle().

◆ CUSTOMPROC_wrapper()

static UINT CUSTOMPROC_wrapper ( MsiCustomActionEntryPoint  proc,
MSIHANDLE  handle 
)
inlinestatic

Definition at line 549 of file custom.c.

550 {
551  return proc(handle);
552 }
static HANDLE proc()
Definition: pdb.c:32

Referenced by ACTION_CallDllFunction().

◆ defer_custom_action()

static UINT defer_custom_action ( MSIPACKAGE package,
const WCHAR action,
UINT  type 
)
static

Definition at line 1157 of file custom.c.

1158 {
1159  WCHAR *actiondata = msi_dup_property( package->db, action );
1160  WCHAR *usersid = msi_dup_property( package->db, szUserSID );
1161  WCHAR *prodcode = msi_dup_property( package->db, szProductCode );
1162  WCHAR *deferred = msi_get_deferred_action( action, actiondata, usersid, prodcode );
1163 
1164  if (!deferred)
1165  {
1166  msi_free( actiondata );
1167  msi_free( usersid );
1168  msi_free( prodcode );
1169  return ERROR_OUTOFMEMORY;
1170  }
1172  {
1173  TRACE("deferring commit action\n");
1174  msi_schedule_action( package, SCRIPT_COMMIT, deferred );
1175  }
1177  {
1178  TRACE("deferring rollback action\n");
1179  msi_schedule_action( package, SCRIPT_ROLLBACK, deferred );
1180  }
1181  else
1182  {
1183  TRACE("deferring install action\n");
1184  msi_schedule_action( package, SCRIPT_INSTALL, deferred );
1185  }
1186 
1187  msi_free( actiondata );
1188  msi_free( usersid );
1189  msi_free( prodcode );
1190  msi_free( deferred );
1191  return ERROR_SUCCESS;
1192 }
static const WCHAR szUserSID[]
Definition: msipriv.h:1126
#define ERROR_SUCCESS
Definition: deptool.c:10
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define TRACE(s)
Definition: solgame.cpp:4
static const WCHAR szProductCode[]
Definition: msipriv.h:1127
__wchar_t WCHAR
Definition: xmlstorage.h:180
MSIDATABASE * db
Definition: msipriv.h:386
static LPWSTR msi_get_deferred_action(LPCWSTR action, LPCWSTR actiondata, LPCWSTR usersid, LPCWSTR prodcode)
Definition: custom.c:163
const WCHAR * action
Definition: action.c:7783
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
UINT msi_schedule_action(MSIPACKAGE *package, UINT script, const WCHAR *action)
Definition: custom.c:72
LPWSTR msi_dup_property(MSIDATABASE *db, LPCWSTR prop) DECLSPEC_HIDDEN
Definition: package.c:2370

Referenced by ACTION_CustomAction().

◆ DllThread()

static DWORD WINAPI DllThread ( LPVOID  arg)
static

Definition at line 621 of file custom.c.

622 {
623  LPGUID guid = arg;
624  DWORD rc = 0;
625 
626  TRACE("custom action (%x) started\n", GetCurrentThreadId() );
627 
629 
630  TRACE("custom action (%x) returned %i\n", GetCurrentThreadId(), rc );
631 
633  return rc;
634 }
UINT WINAPI MsiCloseAllHandles(void)
Definition: handle.c:326
void * arg
Definition: msvc.h:10
static DWORD ACTION_CallDllFunction(const GUID *guid)
Definition: custom.c:555
const GUID * guid
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:458
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95

Referenced by do_msidbCustomActionTypeDll().

◆ do_msidbCustomActionTypeDll()

static msi_custom_action_info* do_msidbCustomActionTypeDll ( MSIPACKAGE package,
INT  type,
LPCWSTR  source,
LPCWSTR  target,
LPCWSTR  action 
)
static

Definition at line 636 of file custom.c.

638 {
640 
641  info = msi_alloc( sizeof *info );
642  if (!info)
643  return NULL;
644 
645  msiobj_addref( &package->hdr );
646  info->refs = 2; /* 1 for our caller and 1 for thread we created */
647  info->package = package;
648  info->type = type;
649  info->target = strdupW( target );
650  info->source = strdupW( source );
651  info->action = strdupW( action );
652  CoCreateGuid( &info->guid );
653 
657 
658  info->handle = CreateThread( NULL, 0, DllThread, &info->guid, 0, NULL );
659  if (!info->handle)
660  {
661  /* release both references */
664  return NULL;
665  }
666 
667  return info;
668 }
void msiobj_addref(MSIOBJECTHDR *info)
Definition: handle.c:218
static DWORD WINAPI DllThread(LPVOID arg)
Definition: custom.c:621
MSIOBJECTHDR hdr
Definition: msipriv.h:385
static WCHAR * strdupW(const WCHAR *src)
Definition: main.c:92
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
struct _test_info info[]
Definition: SetCursorPos.c:19
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:136
smooth NULL
Definition: ftsmooth.c:416
static CRITICAL_SECTION msi_custom_action_cs
Definition: custom.c:60
HRESULT WINAPI CoCreateGuid(GUID *pguid)
Definition: compobj.c:2206
const WCHAR * action
Definition: action.c:7783
static struct list msi_pending_custom_actions
Definition: custom.c:70
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204
GLenum target
Definition: glext.h:7315
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static void release_custom_action_data(msi_custom_action_info *info)
Definition: custom.c:391

Referenced by HANDLE_CustomType1(), and HANDLE_CustomType17().

◆ do_msidbCustomActionTypeScript()

static msi_custom_action_info* do_msidbCustomActionTypeScript ( MSIPACKAGE package,
INT  type,
LPCWSTR  script,
LPCWSTR  function,
LPCWSTR  action 
)
static

Definition at line 968 of file custom.c.

970 {
972 
973  info = msi_alloc( sizeof *info );
974  if (!info)
975  return NULL;
976 
977  msiobj_addref( &package->hdr );
978  info->refs = 2; /* 1 for our caller and 1 for thread we created */
979  info->package = package;
980  info->type = type;
981  info->target = strdupW( function );
982  info->source = strdupW( script );
983  info->action = strdupW( action );
984  CoCreateGuid( &info->guid );
985 
989 
990  info->handle = CreateThread( NULL, 0, ScriptThread, &info->guid, 0, NULL );
991  if (!info->handle)
992  {
993  /* release both references */
996  return NULL;
997  }
998 
999  return info;
1000 }
void msiobj_addref(MSIOBJECTHDR *info)
Definition: handle.c:218
MSIOBJECTHDR hdr
Definition: msipriv.h:385
static WCHAR * strdupW(const WCHAR *src)
Definition: main.c:92
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
struct _test_info info[]
Definition: SetCursorPos.c:19
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:136
smooth NULL
Definition: ftsmooth.c:416
script
Definition: msipriv.h:374
static CRITICAL_SECTION msi_custom_action_cs
Definition: custom.c:60
static DWORD WINAPI ScriptThread(LPVOID arg)
Definition: custom.c:953
HRESULT WINAPI CoCreateGuid(GUID *pguid)
Definition: compobj.c:2206
const WCHAR * action
Definition: action.c:7783
static struct list msi_pending_custom_actions
Definition: custom.c:70
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static void release_custom_action_data(msi_custom_action_info *info)
Definition: custom.c:391

Referenced by HANDLE_CustomType21_22(), HANDLE_CustomType37_38(), HANDLE_CustomType53_54(), and HANDLE_CustomType5_6().

◆ execute_command()

static HANDLE execute_command ( const WCHAR app,
WCHAR arg,
const WCHAR dir 
)
static

Definition at line 685 of file custom.c.

686 {
687  static const WCHAR dotexeW[] = {'.','e','x','e',0};
688  STARTUPINFOW si;
690  WCHAR *exe = NULL, *cmd = NULL, *p;
691  BOOL ret;
692 
693  if (app)
694  {
695  int len_arg = 0;
696  DWORD len_exe;
697 
698  if (!(exe = msi_alloc( MAX_PATH * sizeof(WCHAR) ))) return INVALID_HANDLE_VALUE;
699  len_exe = SearchPathW( NULL, app, dotexeW, MAX_PATH, exe, NULL );
700  if (len_exe >= MAX_PATH)
701  {
702  msi_free( exe );
703  if (!(exe = msi_alloc( len_exe * sizeof(WCHAR) ))) return INVALID_HANDLE_VALUE;
704  len_exe = SearchPathW( NULL, app, dotexeW, len_exe, exe, NULL );
705  }
706  if (!len_exe)
707  {
708  ERR("can't find executable %u\n", GetLastError());
709  msi_free( exe );
710  return INVALID_HANDLE_VALUE;
711  }
712 
713  if (arg) len_arg = strlenW( arg );
714  if (!(cmd = msi_alloc( (len_exe + len_arg + 4) * sizeof(WCHAR) )))
715  {
716  msi_free( exe );
717  return INVALID_HANDLE_VALUE;
718  }
719  p = cmd;
720  if (strchrW( exe, ' ' ))
721  {
722  *p++ = '\"';
723  memcpy( p, exe, len_exe * sizeof(WCHAR) );
724  p += len_exe;
725  *p++ = '\"';
726  *p = 0;
727  }
728  else
729  {
730  strcpyW( p, exe );
731  p += len_exe;
732  }
733  if (arg)
734  {
735  *p++ = ' ';
736  memcpy( p, arg, len_arg * sizeof(WCHAR) );
737  p[len_arg] = 0;
738  }
739  }
740  memset( &si, 0, sizeof(STARTUPINFOW) );
741  ret = CreateProcessW( exe, exe ? cmd : arg, NULL, NULL, FALSE, 0, NULL, dir, &si, &info );
742  msi_free( cmd );
743  msi_free( exe );
744  if (!ret)
745  {
746  ERR("unable to execute command %u\n", GetLastError());
747  return INVALID_HANDLE_VALUE;
748  }
749  CloseHandle( info.hThread );
750  return info.hProcess;
751 }
#define CloseHandle
Definition: compat.h:407
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
Definition: ftp_var.h:139
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
#define INVALID_HANDLE_VALUE
Definition: compat.h:400
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
char * cmd
Definition: vfdcmd.c:85
struct _test_info info[]
Definition: SetCursorPos.c:19
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
unsigned int dir
Definition: maze.c:112
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4593
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
DWORD WINAPI SearchPathW(IN LPCWSTR lpPath OPTIONAL, IN LPCWSTR lpFileName, IN LPCWSTR lpExtension OPTIONAL, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart OPTIONAL)
Definition: path.c:1297
#define ERR(fmt,...)
Definition: debug.h:110
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204
GLfloat GLfloat p
Definition: glext.h:8902
#define memset(x, y, z)
Definition: compat.h:39

Referenced by HANDLE_CustomType18(), HANDLE_CustomType2(), HANDLE_CustomType23(), HANDLE_CustomType34(), and HANDLE_CustomType50().

◆ file_running_action()

static void file_running_action ( MSIPACKAGE package,
HANDLE  Handle,
BOOL  process,
LPCWSTR  name 
)
static

Definition at line 301 of file custom.c.

303 {
305 
306  action = msi_alloc( sizeof(MSIRUNNINGACTION) );
307 
308  action->handle = Handle;
309  action->process = process;
310  action->name = strdupW(name);
311 
312  list_add_tail( &package->RunningActions, &action->entry );
313 }
static WCHAR * strdupW(const WCHAR *src)
Definition: main.c:92
struct list RunningActions
Definition: msipriv.h:422
static HANDLE process
Definition: process.c:76
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
_In_ HANDLE Handle
Definition: extypes.h:390
const WCHAR * action
Definition: action.c:7783
Definition: name.c:38
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204

Referenced by wait_process_handle().

◆ find_action_by_guid()

static msi_custom_action_info* find_action_by_guid ( const GUID guid)
static

Definition at line 439 of file custom.c.

440 {
442  BOOL found = FALSE;
443 
445 
447  {
448  if (IsEqualGUID( &info->guid, guid ))
449  {
451  found = TRUE;
452  break;
453  }
454  }
455 
457 
458  if (!found)
459  return NULL;
460 
461  return info;
462 }
#define TRUE
Definition: types.h:120
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
struct _test_info info[]
Definition: SetCursorPos.c:19
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
const GUID * guid
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
static void addref_custom_action_data(msi_custom_action_info *info)
Definition: custom.c:411
static CRITICAL_SECTION msi_custom_action_cs
Definition: custom.c:60
uint32_t entry
Definition: isohybrid.c:63
static struct list msi_pending_custom_actions
Definition: custom.c:70
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by ACTION_CallScript(), and mcr_GetActionInfo().

◆ get_action_info()

static UINT get_action_info ( const GUID guid,
INT type,
MSIHANDLE handle,
BSTR dll,
BSTR funcname,
IWineMsiRemotePackage **  package 
)
static

Definition at line 498 of file custom.c.

501 {
502  IClassFactory *cf = NULL;
504  HRESULT r;
505 
506  r = DllGetClassObject( &CLSID_WineMsiRemoteCustomAction,
507  &IID_IClassFactory, (LPVOID *)&cf );
508  if (FAILED(r))
509  {
510  ERR("failed to get IClassFactory interface\n");
511  return ERROR_FUNCTION_FAILED;
512  }
513 
514  r = IClassFactory_CreateInstance( cf, NULL, &IID_IWineMsiRemoteCustomAction, (LPVOID *)&rca );
515  if (FAILED(r))
516  {
517  ERR("failed to get IWineMsiRemoteCustomAction interface\n");
518  return ERROR_FUNCTION_FAILED;
519  }
520 
521  r = IWineMsiRemoteCustomAction_GetActionInfo( rca, guid, type, handle, dll, funcname, package );
522  IWineMsiRemoteCustomAction_Release( rca );
523  if (FAILED(r))
524  {
525  ERR("GetActionInfo failed\n");
526  return ERROR_FUNCTION_FAILED;
527  }
528 
529  return ERROR_SUCCESS;
530 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: shsvcs.c:38
static HMODULE dll
Definition: str.c:188
const GUID * guid
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:78
#define funcname
Definition: shellext.h:96
#define ERR(fmt,...)
Definition: debug.h:110
const GUID IID_IClassFactory

Referenced by ACTION_CallDllFunction().

◆ get_temp_binary()

static MSIBINARY* get_temp_binary ( MSIPACKAGE package,
LPCWSTR  source,
BOOL  dll 
)
static

Definition at line 288 of file custom.c.

289 {
290  MSIBINARY *binary;
291 
293  {
294  if (!strcmpW( binary->source, source ))
295  return binary;
296  }
297 
298  return create_temp_binary( package, source, dll );
299 }
static HMODULE dll
Definition: str.c:188
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
struct list binaries
Definition: msipriv.h:398
const GLuint GLenum const GLvoid * binary
Definition: glext.h:7538
uint32_t entry
Definition: isohybrid.c:63
static MSIBINARY * create_temp_binary(MSIPACKAGE *package, LPCWSTR source, BOOL dll)
Definition: custom.c:231
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229

Referenced by HANDLE_CustomType1(), and HANDLE_CustomType2().

◆ HANDLE_CustomType1()

static UINT HANDLE_CustomType1 ( MSIPACKAGE package,
const WCHAR source,
const WCHAR target,
INT  type,
const WCHAR action 
)
static

Definition at line 670 of file custom.c.

672 {
674  MSIBINARY *binary;
675 
676  if (!(binary = get_temp_binary( package, source, TRUE )))
677  return ERROR_FUNCTION_FAILED;
678 
679  TRACE("Calling function %s from %s\n", debugstr_w(target), debugstr_w(binary->tmpfile));
680 
681  info = do_msidbCustomActionTypeDll( package, type, binary->tmpfile, target, action );
682  return wait_thread_handle( info );
683 }
#define TRUE
Definition: types.h:120
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
struct _test_info info[]
Definition: SetCursorPos.c:19
static MSIBINARY * get_temp_binary(MSIPACKAGE *package, LPCWSTR source, BOOL dll)
Definition: custom.c:288
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define debugstr_w
Definition: kernel32.h:32
static msi_custom_action_info * do_msidbCustomActionTypeDll(MSIPACKAGE *package, INT type, LPCWSTR source, LPCWSTR target, LPCWSTR action)
Definition: custom.c:636
#define TRACE(s)
Definition: solgame.cpp:4
const GLuint GLenum const GLvoid * binary
Definition: glext.h:7538
static UINT wait_thread_handle(msi_custom_action_info *info)
Definition: custom.c:416
const WCHAR * action
Definition: action.c:7783
GLenum target
Definition: glext.h:7315

Referenced by ACTION_CustomAction().

◆ HANDLE_CustomType17()

static UINT HANDLE_CustomType17 ( MSIPACKAGE package,
const WCHAR source,
const WCHAR target,
INT  type,
const WCHAR action 
)
static

Definition at line 771 of file custom.c.

773 {
775  MSIFILE *file;
776 
777  TRACE("%s %s\n", debugstr_w(source), debugstr_w(target));
778 
779  file = msi_get_loaded_file( package, source );
780  if (!file)
781  {
782  ERR("invalid file key %s\n", debugstr_w( source ));
783  return ERROR_FUNCTION_FAILED;
784  }
785 
786  info = do_msidbCustomActionTypeDll( package, type, file->TargetPath, target, action );
787  return wait_thread_handle( info );
788 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
struct _test_info info[]
Definition: SetCursorPos.c:19
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define debugstr_w
Definition: kernel32.h:32
static msi_custom_action_info * do_msidbCustomActionTypeDll(MSIPACKAGE *package, INT type, LPCWSTR source, LPCWSTR target, LPCWSTR action)
Definition: custom.c:636
MSIFILE * msi_get_loaded_file(MSIPACKAGE *package, const WCHAR *key)
Definition: action.c:674
#define TRACE(s)
Definition: solgame.cpp:4
const char file[]
Definition: icontest.c:11
#define ERR(fmt,...)
Definition: debug.h:110
static UINT wait_thread_handle(msi_custom_action_info *info)
Definition: custom.c:416
const WCHAR * action
Definition: action.c:7783
GLenum target
Definition: glext.h:7315
Definition: fci.c:126

Referenced by ACTION_CustomAction().

◆ HANDLE_CustomType18()

static UINT HANDLE_CustomType18 ( MSIPACKAGE package,
const WCHAR source,
const WCHAR target,
INT  type,
const WCHAR action 
)
static

Definition at line 790 of file custom.c.

792 {
793  MSIFILE *file;
794  HANDLE handle;
795  WCHAR *arg;
796 
797  if (!(file = msi_get_loaded_file( package, source ))) return ERROR_FUNCTION_FAILED;
798 
799  deformat_string( package, target, &arg );
800  TRACE("exe %s arg %s\n", debugstr_w(file->TargetPath), debugstr_w(arg));
801 
802  handle = execute_command( file->TargetPath, arg, szCRoot );
803  msi_free( arg );
805  return wait_process_handle( package, type, handle, action );
806 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define ERROR_SUCCESS
Definition: deptool.c:10
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define INVALID_HANDLE_VALUE
Definition: compat.h:400
void * arg
Definition: msvc.h:10
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define debugstr_w
Definition: kernel32.h:32
static UINT wait_process_handle(MSIPACKAGE *package, UINT type, HANDLE ProcessHandle, LPCWSTR name)
Definition: custom.c:350
MSIFILE * msi_get_loaded_file(MSIPACKAGE *package, const WCHAR *key)
Definition: action.c:674
DWORD deformat_string(MSIPACKAGE *package, const WCHAR *fmt, WCHAR **data)
Definition: format.c:1016
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
const char file[]
Definition: icontest.c:11
static HANDLE execute_command(const WCHAR *app, WCHAR *arg, const WCHAR *dir)
Definition: custom.c:685
const WCHAR * action
Definition: action.c:7783
static const WCHAR szCRoot[]
Definition: msipriv.h:1184
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
GLenum target
Definition: glext.h:7315
Definition: fci.c:126

Referenced by ACTION_CustomAction().

◆ HANDLE_CustomType19()

static UINT HANDLE_CustomType19 ( MSIPACKAGE package,
const WCHAR source,
const WCHAR target,
INT  type,
const WCHAR action 
)
static

Definition at line 808 of file custom.c.

810 {
811  static const WCHAR query[] = {
812  'S','E','L','E','C','T',' ','`','M','e','s','s','a','g','e','`',' ',
813  'F','R','O','M',' ','`','E','r','r','o','r','`',' ',
814  'W','H','E','R','E',' ','`','E','r','r','o','r','`',' ','=',' ',
815  '%','s',0
816  };
817  MSIRECORD *row = 0;
818  LPWSTR deformated = NULL;
819 
820  deformat_string( package, target, &deformated );
821 
822  /* first try treat the error as a number */
823  row = MSI_QueryGetRecord( package->db, query, deformated );
824  if( row )
825  {
829  msiobj_release( &row->hdr );
830  }
831  else if ((package->ui_level & INSTALLUILEVEL_MASK) != INSTALLUILEVEL_NONE)
832  MessageBoxW( NULL, deformated, NULL, MB_OK );
833 
834  msi_free( deformated );
835 
836  return ERROR_INSTALL_FAILURE;
837 }
#define error(str)
Definition: mkdosfs.c:1605
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
smooth NULL
Definition: ftsmooth.c:416
const WCHAR * MSI_RecordGetString(const MSIRECORD *, UINT) DECLSPEC_HIDDEN
Definition: record.c:482
DWORD deformat_string(MSIPACKAGE *package, const WCHAR *fmt, WCHAR **data)
Definition: format.c:1016
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
MSIRECORD * MSI_QueryGetRecord(MSIDATABASE *db, LPCWSTR query,...) DECLSPEC_HIDDEN
Definition: msiquery.c:206
INSTALLUILEVEL ui_level
Definition: msipriv.h:430
#define ERROR_INSTALL_FAILURE
Definition: winerror.h:961
MSIDATABASE * db
Definition: msipriv.h:386
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:242
#define INSTALLUILEVEL_MASK
Definition: msipriv.h:57
#define MB_OK
Definition: winuser.h:784
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
GLenum target
Definition: glext.h:7315
WCHAR * LPWSTR
Definition: xmlstorage.h:184
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78

Referenced by ACTION_CustomAction().

◆ HANDLE_CustomType2()

static UINT HANDLE_CustomType2 ( MSIPACKAGE package,
const WCHAR source,
const WCHAR target,
INT  type,
const WCHAR action 
)
static

Definition at line 753 of file custom.c.

755 {
756  MSIBINARY *binary;
757  HANDLE handle;
758  WCHAR *arg;
759 
760  if (!(binary = get_temp_binary( package, source, FALSE ))) return ERROR_FUNCTION_FAILED;
761 
762  deformat_string( package, target, &arg );
763  TRACE("exe %s arg %s\n", debugstr_w(binary->tmpfile), debugstr_w(arg));
764 
765  handle = execute_command( binary->tmpfile, arg, szCRoot );
766  msi_free( arg );
768  return wait_process_handle( package, type, handle, action );
769 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define ERROR_SUCCESS
Definition: deptool.c:10
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define INVALID_HANDLE_VALUE
Definition: compat.h:400
void * arg
Definition: msvc.h:10
static MSIBINARY * get_temp_binary(MSIPACKAGE *package, LPCWSTR source, BOOL dll)
Definition: custom.c:288
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define debugstr_w
Definition: kernel32.h:32
static UINT wait_process_handle(MSIPACKAGE *package, UINT type, HANDLE ProcessHandle, LPCWSTR name)
Definition: custom.c:350
DWORD deformat_string(MSIPACKAGE *package, const WCHAR *fmt, WCHAR **data)
Definition: format.c:1016
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
const GLuint GLenum const GLvoid * binary
Definition: glext.h:7538
static HANDLE execute_command(const WCHAR *app, WCHAR *arg, const WCHAR *dir)
Definition: custom.c:685
const WCHAR * action
Definition: action.c:7783
static const WCHAR szCRoot[]
Definition: msipriv.h:1184
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
GLenum target
Definition: glext.h:7315

Referenced by ACTION_CustomAction().

◆ HANDLE_CustomType21_22()

static UINT HANDLE_CustomType21_22 ( MSIPACKAGE package,
const WCHAR source,
const WCHAR target,
INT  type,
const WCHAR action 
)
static

Definition at line 1065 of file custom.c.

1067 {
1069  MSIFILE *file;
1070  HANDLE hFile;
1071  DWORD sz, szHighWord = 0, read;
1072  CHAR *buffer=NULL;
1073  WCHAR *bufferw=NULL;
1074  BOOL bRet;
1075  UINT r;
1076 
1077  TRACE("%s %s\n", debugstr_w(source), debugstr_w(target));
1078 
1079  file = msi_get_loaded_file(package, source);
1080  if (!file)
1081  {
1082  ERR("invalid file key %s\n", debugstr_w(source));
1083  return ERROR_FUNCTION_FAILED;
1084  }
1085 
1088 
1089  sz = GetFileSize(hFile, &szHighWord);
1090  if (sz == INVALID_FILE_SIZE || szHighWord != 0)
1091  {
1092  CloseHandle(hFile);
1093  return ERROR_FUNCTION_FAILED;
1094  }
1095  buffer = msi_alloc( sz + 1 );
1096  if (!buffer)
1097  {
1098  CloseHandle(hFile);
1099  return ERROR_FUNCTION_FAILED;
1100  }
1101  bRet = ReadFile(hFile, buffer, sz, &read, NULL);
1102  CloseHandle(hFile);
1103  if (!bRet)
1104  {
1106  goto done;
1107  }
1108  buffer[read] = 0;
1109  bufferw = strdupAtoW(buffer);
1110  if (!bufferw)
1111  {
1113  goto done;
1114  }
1115  info = do_msidbCustomActionTypeScript( package, type, bufferw, target, action );
1116  r = wait_thread_handle( info );
1117 
1118 done:
1119  msi_free(bufferw);
1120  msi_free(buffer);
1121  return r;
1122 }
#define CloseHandle
Definition: compat.h:407
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
char CHAR
Definition: xmlstorage.h:175
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define INVALID_HANDLE_VALUE
Definition: compat.h:400
GLuint buffer
Definition: glext.h:5915
#define INVALID_FILE_SIZE
Definition: winbase.h:529
#define FILE_SHARE_READ
Definition: compat.h:125
struct _test_info info[]
Definition: SetCursorPos.c:19
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:435
MSIFILE * msi_get_loaded_file(MSIPACKAGE *package, const WCHAR *key)
Definition: action.c:674
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
const char file[]
Definition: icontest.c:11
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:481
#define GENERIC_READ
Definition: compat.h:124
_In_ HANDLE hFile
Definition: mswsock.h:90
#define ERR(fmt,...)
Definition: debug.h:110
static UINT wait_thread_handle(msi_custom_action_info *info)
Definition: custom.c:416
const WCHAR * action
Definition: action.c:7783
unsigned int UINT
Definition: ndis.h:50
#define CreateFileW
Definition: compat.h:409
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204
GLenum target
Definition: glext.h:7315
BOOL WINAPI ReadFile(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead, OUT LPDWORD lpNumberOfBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:123
static WCHAR * strdupAtoW(const char *str)
Definition: main.c:65
static msi_custom_action_info * do_msidbCustomActionTypeScript(MSIPACKAGE *package, INT type, LPCWSTR script, LPCWSTR function, LPCWSTR action)
Definition: custom.c:968
_CRTIMP int __cdecl read(_In_ int _FileHandle, _Out_writes_bytes_(_MaxCharCount) void *_DstBuf, _In_ unsigned int _MaxCharCount)
Definition: fci.c:126

Referenced by ACTION_CustomAction().

◆ HANDLE_CustomType23()

static UINT HANDLE_CustomType23 ( MSIPACKAGE package,
const WCHAR source,
const WCHAR target,
INT  type,
const WCHAR action 
)
static

Definition at line 839 of file custom.c.

841 {
842  static const WCHAR msiexecW[] = {'m','s','i','e','x','e','c',0};
843  static const WCHAR paramsW[] = {'/','q','b',' ','/','i',' '};
844  WCHAR *dir, *arg, *p;
845  UINT len_src, len_dir, len_tgt, len = sizeof(paramsW)/sizeof(paramsW[0]);
846  HANDLE handle;
847 
848  if (!(dir = msi_dup_property( package->db, szOriginalDatabase ))) return ERROR_OUTOFMEMORY;
849  if (!(p = strrchrW( dir, '\\' )) && !(p = strrchrW( dir, '/' )))
850  {
851  msi_free( dir );
852  return ERROR_FUNCTION_FAILED;
853  }
854  *p = 0;
855  len_dir = p - dir;
856  len_src = strlenW( source );
857  len_tgt = strlenW( target );
858  if (!(arg = msi_alloc( (len + len_dir + len_src + len_tgt + 5) * sizeof(WCHAR) )))
859  {
860  msi_free( dir );
861  return ERROR_OUTOFMEMORY;
862  }
863  memcpy( arg, paramsW, sizeof(paramsW) );
864  arg[len++] = '"';
865  memcpy( arg + len, dir, len_dir * sizeof(WCHAR) );
866  len += len_dir;
867  arg[len++] = '\\';
868  memcpy( arg + len, source, len_src * sizeof(WCHAR) );
869  len += len_src;
870  arg[len++] = '"';
871  arg[len++] = ' ';
872  strcpyW( arg + len, target );
873 
874  TRACE("installing %s concurrently\n", debugstr_w(source));
875 
876  handle = execute_command( msiexecW, arg, dir );
877  msi_free( dir );
878  msi_free( arg );
880  return wait_process_handle( package, type, handle, action );
881 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define ERROR_SUCCESS
Definition: deptool.c:10
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define INVALID_HANDLE_VALUE
Definition: compat.h:400
void * arg
Definition: msvc.h:10
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define debugstr_w
Definition: kernel32.h:32
static UINT wait_process_handle(MSIPACKAGE *package, UINT type, HANDLE ProcessHandle, LPCWSTR name)
Definition: custom.c:350
unsigned int dir
Definition: maze.c:112
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
MSIDATABASE * db
Definition: msipriv.h:386
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
WINE_UNICODE_INLINE WCHAR * strrchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:254
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
static HANDLE execute_command(const WCHAR *app, WCHAR *arg, const WCHAR *dir)
Definition: custom.c:685
const WCHAR * action
Definition: action.c:7783
static const WCHAR szOriginalDatabase[]
Definition: msipriv.h:1169
unsigned int UINT
Definition: ndis.h:50
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204
GLenum target
Definition: glext.h:7315
GLfloat GLfloat p
Definition: glext.h:8902
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
LPWSTR msi_dup_property(MSIDATABASE *db, LPCWSTR prop) DECLSPEC_HIDDEN
Definition: package.c:2370

Referenced by ACTION_CustomAction().

◆ HANDLE_CustomType34()

static UINT HANDLE_CustomType34 ( MSIPACKAGE package,
const WCHAR source,
const WCHAR target,
INT  type,
const WCHAR action 
)
static

Definition at line 901 of file custom.c.

903 {
904  const WCHAR *workingdir = NULL;
905  HANDLE handle;
906  WCHAR *cmd;
907 
908  if (source)
909  {
910  workingdir = msi_get_target_folder( package, source );
911  if (!workingdir) return ERROR_FUNCTION_FAILED;
912  }
913  deformat_string( package, target, &cmd );
914  if (!cmd) return ERROR_FUNCTION_FAILED;
915 
916  TRACE("cmd %s dir %s\n", debugstr_w(cmd), debugstr_w(workingdir));
917 
918  handle = execute_command( NULL, cmd, workingdir );
919  msi_free( cmd );
921  return wait_process_handle( package, type, handle, action );
922 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define ERROR_SUCCESS
Definition: deptool.c:10
Definition: ftp_var.h:139
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define INVALID_HANDLE_VALUE
Definition: compat.h:400
char * cmd
Definition: vfdcmd.c:85
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define debugstr_w
Definition: kernel32.h:32
static UINT wait_process_handle(MSIPACKAGE *package, UINT type, HANDLE ProcessHandle, LPCWSTR name)
Definition: custom.c:350
smooth NULL
Definition: ftsmooth.c:416
DWORD deformat_string(MSIPACKAGE *package, const WCHAR *fmt, WCHAR **data)
Definition: format.c:1016
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * msi_get_target_folder(MSIPACKAGE *package, const WCHAR *name)
Definition: install.c:209
static HANDLE execute_command(const WCHAR *app, WCHAR *arg, const WCHAR *dir)
Definition: custom.c:685
const WCHAR * action
Definition: action.c:7783
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
GLenum target
Definition: glext.h:7315

Referenced by ACTION_CustomAction().

◆ HANDLE_CustomType37_38()

static UINT HANDLE_CustomType37_38 ( MSIPACKAGE package,
const WCHAR source,
const WCHAR target,
INT  type,
const WCHAR action 
)
static

Definition at line 1002 of file custom.c.

1004 {
1006 
1007  TRACE("%s %s\n", debugstr_w(source), debugstr_w(target));
1008 
1010  return wait_thread_handle( info );
1011 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
struct _test_info info[]
Definition: SetCursorPos.c:19
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static UINT wait_thread_handle(msi_custom_action_info *info)
Definition: custom.c:416
const WCHAR * action
Definition: action.c:7783
GLenum target
Definition: glext.h:7315
static msi_custom_action_info * do_msidbCustomActionTypeScript(MSIPACKAGE *package, INT type, LPCWSTR script, LPCWSTR function, LPCWSTR action)
Definition: custom.c:968

Referenced by ACTION_CustomAction().

◆ HANDLE_CustomType50()

static UINT HANDLE_CustomType50 ( MSIPACKAGE package,
const WCHAR source,
const WCHAR target,
INT  type,
const WCHAR action 
)
static

Definition at line 883 of file custom.c.

885 {
886  WCHAR *exe, *arg;
887  HANDLE handle;
888 
889  if (!(exe = msi_dup_property( package->db, source ))) return ERROR_SUCCESS;
890 
891  deformat_string( package, target, &arg );
892  TRACE("exe %s arg %s\n", debugstr_w(exe), debugstr_w(arg));
893 
894  handle = execute_command( exe, arg, szCRoot );
895  msi_free( exe );
896  msi_free( arg );
898  return wait_process_handle( package, type, handle, action );
899 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define ERROR_SUCCESS
Definition: deptool.c:10
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define INVALID_HANDLE_VALUE
Definition: compat.h:400
void * arg
Definition: msvc.h:10
#define debugstr_w
Definition: kernel32.h:32
static UINT wait_process_handle(MSIPACKAGE *package, UINT type, HANDLE ProcessHandle, LPCWSTR name)
Definition: custom.c:350
DWORD deformat_string(MSIPACKAGE *package, const WCHAR *fmt, WCHAR **data)
Definition: format.c:1016
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
MSIDATABASE * db
Definition: msipriv.h:386
static HANDLE execute_command(const WCHAR *app, WCHAR *arg, const WCHAR *dir)
Definition: custom.c:685
const WCHAR * action
Definition: action.c:7783
static const WCHAR szCRoot[]
Definition: msipriv.h:1184
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
GLenum target
Definition: glext.h:7315
LPWSTR msi_dup_property(MSIDATABASE *db, LPCWSTR prop) DECLSPEC_HIDDEN
Definition: package.c:2370

Referenced by ACTION_CustomAction().

◆ HANDLE_CustomType53_54()

static UINT HANDLE_CustomType53_54 ( MSIPACKAGE package,
const WCHAR source,
const WCHAR target,
INT  type,
const WCHAR action 
)
static

Definition at line 1124 of file custom.c.

1126 {
1128  WCHAR *prop;
1129 
1130  TRACE("%s %s\n", debugstr_w(source), debugstr_w(target));
1131 
1132  prop = msi_dup_property( package->db, source );
1133  if (!prop) return ERROR_SUCCESS;
1134 
1135  info = do_msidbCustomActionTypeScript( package, type, prop, NULL, action );
1136  msi_free(prop);
1137  return wait_thread_handle( info );
1138 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
struct _test_info info[]
Definition: SetCursorPos.c:19
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
MSIDATABASE * db
Definition: msipriv.h:386
static UINT wait_thread_handle(msi_custom_action_info *info)
Definition: custom.c:416
const WCHAR * action
Definition: action.c:7783
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
GLenum target
Definition: glext.h:7315
static msi_custom_action_info * do_msidbCustomActionTypeScript(MSIPACKAGE *package, INT type, LPCWSTR script, LPCWSTR function, LPCWSTR action)
Definition: custom.c:968
LPWSTR msi_dup_property(MSIDATABASE *db, LPCWSTR prop) DECLSPEC_HIDDEN
Definition: package.c:2370

Referenced by ACTION_CustomAction().

◆ HANDLE_CustomType5_6()

static UINT HANDLE_CustomType5_6 ( MSIPACKAGE package,
const WCHAR source,
const WCHAR target,
INT  type,
const WCHAR action 
)
static

Definition at line 1013 of file custom.c.

1015 {
1016  static const WCHAR query[] = {
1017  'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
1018  '`','B','i' ,'n','a','r','y','`',' ','W','H','E','R','E',' ',
1019  '`','N','a','m','e','`',' ','=',' ','\'','%','s','\'',0};
1020  MSIRECORD *row = NULL;
1022  CHAR *buffer = NULL;
1023  WCHAR *bufferw = NULL;
1024  DWORD sz = 0;
1025  UINT r;
1026 
1027  TRACE("%s %s\n", debugstr_w(source), debugstr_w(target));
1028 
1029  row = MSI_QueryGetRecord(package->db, query, source);
1030  if (!row)
1031  return ERROR_FUNCTION_FAILED;
1032 
1033  r = MSI_RecordReadStream(row, 2, NULL, &sz);
1034  if (r != ERROR_SUCCESS) goto done;
1035 
1036  buffer = msi_alloc( sz + 1 );
1037  if (!buffer)
1038  {
1040  goto done;
1041  }
1042 
1043  r = MSI_RecordReadStream(row, 2, buffer, &sz);
1044  if (r != ERROR_SUCCESS)
1045  goto done;
1046 
1047  buffer[sz] = 0;
1048  bufferw = strdupAtoW(buffer);
1049  if (!bufferw)
1050  {
1052  goto done;
1053  }
1054 
1055  info = do_msidbCustomActionTypeScript( package, type, bufferw, target, action );
1056  r = wait_thread_handle( info );
1057 
1058 done:
1059  msi_free(bufferw);
1060  msi_free(buffer);
1061  msiobj_release(&row->hdr);
1062  return r;
1063 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
char CHAR
Definition: xmlstorage.h:175
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint buffer
Definition: glext.h:5915
struct _test_info info[]
Definition: SetCursorPos.c:19
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
MSIRECORD * MSI_QueryGetRecord(MSIDATABASE *db, LPCWSTR query,...) DECLSPEC_HIDDEN
Definition: msiquery.c:206
unsigned long DWORD
Definition: ntddk_ex.h:95
MSIDATABASE * db
Definition: msipriv.h:386
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:242
static UINT wait_thread_handle(msi_custom_action_info *info)
Definition: custom.c:416
const WCHAR * action
Definition: action.c:7783
unsigned int UINT
Definition: ndis.h:50
UINT MSI_RecordReadStream(MSIRECORD *, UINT, char *, LPDWORD) DECLSPEC_HIDDEN
Definition: record.c:814
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204
GLenum target
Definition: glext.h:7315
static WCHAR * strdupAtoW(const char *str)
Definition: main.c:65
static msi_custom_action_info * do_msidbCustomActionTypeScript(MSIPACKAGE *package, INT type, LPCWSTR script, LPCWSTR function, LPCWSTR action)
Definition: custom.c:968
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78

Referenced by ACTION_CustomAction().

◆ handle_msi_break()

static void handle_msi_break ( LPCWSTR  target)
static

Definition at line 464 of file custom.c.

465 {
466  LPWSTR msg;
467  WCHAR val[MAX_PATH];
468 
469  static const WCHAR MsiBreak[] = { 'M','s','i','B','r','e','a','k',0 };
470  static const WCHAR WindowsInstaller[] = {
471  'W','i','n','d','o','w','s',' ','I','n','s','t','a','l','l','e','r',0
472  };
473 
474  static const WCHAR format[] = {
475  'T','o',' ','d','e','b','u','g',' ','y','o','u','r',' ',
476  'c','u','s','t','o','m',' ','a','c','t','i','o','n',',',' ',
477  'a','t','t','a','c','h',' ','y','o','u','r',' ','d','e','b','u','g','g','e','r',' ',
478  't','o',' ','p','r','o','c','e','s','s',' ','%','i',' ','(','0','x','%','X',')',' ',
479  'a','n','d',' ','p','r','e','s','s',' ','O','K',0
480  };
481 
482  if( !GetEnvironmentVariableW( MsiBreak, val, MAX_PATH ))
483  return;
484 
485  if( strcmpiW( val, target ))
486  return;
487 
488  msg = msi_alloc( (lstrlenW(format) + 10) * sizeof(WCHAR) );
489  if (!msg)
490  return;
491 
494  msi_free(msg);
495  DebugBreak();
496 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
#define lstrlenW
Definition: compat.h:416
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
void WINAPI DebugBreak(void)
smooth NULL
Definition: ftsmooth.c:416
GLuint GLfloat * val
Definition: glext.h:7180
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
#define strcmpiW(s1, s2)
Definition: unicode.h:39
#define MB_OK
Definition: winuser.h:784
#define msg(x)
Definition: auth_time.c:54
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204
GLenum target
Definition: glext.h:7315
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define GetEnvironmentVariableW(x, y, z)
Definition: compat.h:421
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1158

Referenced by ACTION_CallDllFunction().

◆ impl_from_IWineMsiRemoteCustomAction()

static msi_custom_remote_impl* impl_from_IWineMsiRemoteCustomAction ( IWineMsiRemoteCustomAction iface)
inlinestatic

Definition at line 1398 of file custom.c.

1399 {
1400  return CONTAINING_RECORD(iface, msi_custom_remote_impl, IWineMsiRemoteCustomAction_iface);
1401 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by mcr_AddRef(), and mcr_Release().

◆ mcr_AddRef()

static ULONG WINAPI mcr_AddRef ( IWineMsiRemoteCustomAction iface)
static

Definition at line 1417 of file custom.c.

1418 {
1420 
1421  return InterlockedIncrement( &This->refs );
1422 }
#define InterlockedIncrement
Definition: armddk.h:53
static msi_custom_remote_impl * impl_from_IWineMsiRemoteCustomAction(IWineMsiRemoteCustomAction *iface)
Definition: custom.c:1398

◆ mcr_GetActionInfo()

static HRESULT WINAPI mcr_GetActionInfo ( IWineMsiRemoteCustomAction iface,
LPCGUID  custom_action_guid,
INT type,
MSIHANDLE handle,
BSTR dll,
BSTR func,
IWineMsiRemotePackage **  remote_package 
)
static

Definition at line 1435 of file custom.c.

1437 {
1439 
1440  info = find_action_by_guid( custom_action_guid );
1441  if (!info)
1442  return E_FAIL;
1443 
1444  *type = info->type;
1445  *handle = alloc_msihandle( &info->package->hdr );
1446  *dll = SysAllocString( info->source );
1447  *func = SysAllocString( info->target );
1448 
1450  return create_msi_remote_package( NULL, (LPVOID *)remote_package );
1451 }
GLenum func
Definition: glext.h:6028
HRESULT create_msi_remote_package(IUnknown *pOuter, LPVOID *ppObj) DECLSPEC_HIDDEN
Definition: package.c:2783
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define E_FAIL
Definition: ddrawi.h:102
struct _test_info info[]
Definition: SetCursorPos.c:19
static HMODULE dll
Definition: str.c:188
smooth NULL
Definition: ftsmooth.c:416
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
MSIHANDLE alloc_msihandle(MSIOBJECTHDR *obj)
Definition: handle.c:109
static msi_custom_action_info * find_action_by_guid(const GUID *guid)
Definition: custom.c:439
static void release_custom_action_data(msi_custom_action_info *info)
Definition: custom.c:391

◆ mcr_QueryInterface()

static HRESULT WINAPI mcr_QueryInterface ( IWineMsiRemoteCustomAction iface,
REFIID  riid,
LPVOID ppobj 
)
static

Definition at line 1403 of file custom.c.

1405 {
1406  if( IsEqualCLSID( riid, &IID_IUnknown ) ||
1407  IsEqualCLSID( riid, &IID_IWineMsiRemoteCustomAction ) )
1408  {
1409  IWineMsiRemoteCustomAction_AddRef( iface );
1410  *ppobj = iface;
1411  return S_OK;
1412  }
1413 
1414  return E_NOINTERFACE;
1415 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96

◆ mcr_Release()

static ULONG WINAPI mcr_Release ( IWineMsiRemoteCustomAction iface)
static

Definition at line 1424 of file custom.c.

1425 {
1427  ULONG r;
1428 
1429  r = InterlockedDecrement( &This->refs );
1430  if (r == 0)
1431  msi_free( This );
1432  return r;
1433 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define InterlockedDecrement
Definition: armddk.h:52
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
unsigned int ULONG
Definition: retypes.h:1
static msi_custom_remote_impl * impl_from_IWineMsiRemoteCustomAction(IWineMsiRemoteCustomAction *iface)
Definition: custom.c:1398

◆ msi_action_is_unique()

BOOL msi_action_is_unique ( const MSIPACKAGE package,
const WCHAR action 
)

Definition at line 113 of file custom.c.

114 {
115  UINT i;
116 
117  for (i = 0; i < package->unique_actions_count; i++)
118  {
119  if (!strcmpW( package->unique_actions[i], action )) return TRUE;
120  }
121  return FALSE;
122 }
#define TRUE
Definition: types.h:120
LPWSTR * unique_actions
Definition: msipriv.h:417
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
int unique_actions_count
Definition: msipriv.h:418
const WCHAR * action
Definition: action.c:7783
unsigned int UINT
Definition: ndis.h:50
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229

Referenced by ACTION_AppSearch(), ACTION_CCPSearch(), ACTION_FindRelatedProducts(), and check_execution_scheduling_options().

◆ msi_create_temp_file()

WCHAR* msi_create_temp_file ( MSIDATABASE db)

Definition at line 202 of file custom.c.

203 {
204  WCHAR *ret;
205 
206  if (!db->tempfolder)
207  {
208  WCHAR tmp[MAX_PATH];
209  UINT len = sizeof(tmp)/sizeof(tmp[0]);
210 
211  if (msi_get_property( db, szTempFolder, tmp, &len ) ||
213  {
214  GetTempPathW( MAX_PATH, tmp );
215  }
216  if (!(db->tempfolder = strdupW( tmp ))) return NULL;
217  }
218 
219  if ((ret = msi_alloc( (strlenW( db->tempfolder ) + 20) * sizeof(WCHAR) )))
220  {
221  if (!GetTempFileNameW( db->tempfolder, szMsi, 0, ret ))
222  {
223  msi_free( ret );
224  return NULL;
225  }
226  }
227 
228  return ret;
229 }
LPWSTR tempfolder
Definition: msipriv.h:103
UINT msi_get_property(MSIDATABASE *, LPCWSTR, LPWSTR, LPDWORD) DECLSPEC_HIDDEN
Definition: package.c:2336
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
static WCHAR * strdupW(const WCHAR *src)
Definition: main.c:92
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2079
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:802
smooth NULL
Definition: ftsmooth.c:416
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName)
Definition: filename.c:84
static const WCHAR szMsi[]
Definition: msipriv.h:1119
int ret
GLenum GLsizei len
Definition: glext.h:6722
static const WCHAR szTempFolder[]
Definition: msipriv.h:1182
unsigned int UINT
Definition: ndis.h:50
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204

Referenced by create_temp_binary(), msi_load_image(), patch_file(), and patchfiles_cb().

◆ msi_get_deferred_action()

static LPWSTR msi_get_deferred_action ( LPCWSTR  action,
LPCWSTR  actiondata,
LPCWSTR  usersid,
LPCWSTR  prodcode 
)
static

Definition at line 163 of file custom.c.

165 {
166  LPWSTR deferred;
167  DWORD len;
168 
169  static const WCHAR format[] = {
170  '[','%','s','<','=','>','%','s','<','=','>','%','s',']','%','s',0
171  };
172 
173  if (!actiondata)
174  return strdupW(action);
175 
176  len = lstrlenW(action) + lstrlenW(actiondata) +
177  lstrlenW(usersid) + lstrlenW(prodcode) +
178  lstrlenW(format) - 7;
179  deferred = msi_alloc(len * sizeof(WCHAR));
180 
181  sprintfW(deferred, format, actiondata, usersid, prodcode, action);
182  return deferred;
183 }
static WCHAR * strdupW(const WCHAR *src)
Definition: main.c:92
#define lstrlenW
Definition: compat.h:416
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
const WCHAR * action
Definition: action.c:7783
#define sprintfW
Definition: unicode.h:58
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by defer_custom_action().

◆ msi_register_unique_action()

UINT msi_register_unique_action ( MSIPACKAGE package,
const WCHAR action 
)

Definition at line 95 of file custom.c.

96 {
97  UINT count;
98  WCHAR **newbuf = NULL;
99 
100  TRACE("Registering %s as unique action\n", debugstr_w(action));
101 
102  count = package->unique_actions_count;
103  package->unique_actions_count++;
104  if (count != 0) newbuf = msi_realloc( package->unique_actions,
105  package->unique_actions_count * sizeof(WCHAR *) );
106  else newbuf = msi_alloc( sizeof(WCHAR *) );
107 
108  newbuf[count] = strdupW( action );
109  package->unique_actions = newbuf;
110  return ERROR_SUCCESS;
111 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static WCHAR * strdupW(const WCHAR *src)
Definition: main.c:92
GLuint GLuint GLsizei count
Definition: gl.h:1545
LPWSTR * unique_actions
Definition: msipriv.h:417
static void * msi_realloc(void *mem, size_t len) __WINE_ALLOC_SIZE(2)
Definition: msipriv.h:1216
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
int unique_actions_count
Definition: msipriv.h:418
const WCHAR * action
Definition: action.c:7783
unsigned int UINT
Definition: ndis.h:50
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204

Referenced by ACTION_AppSearch(), ACTION_CCPSearch(), ACTION_FindRelatedProducts(), and check_execution_scheduling_options().

◆ msi_schedule_action()

UINT msi_schedule_action ( MSIPACKAGE package,
UINT  script,
const WCHAR action 
)

Definition at line 72 of file custom.c.

73 {
74  UINT count;
75  WCHAR **newbuf = NULL;
76 
77  if (script >= SCRIPT_MAX)
78  {
79  FIXME("Unknown script requested %u\n", script);
80  return ERROR_FUNCTION_FAILED;
81  }
82  TRACE("Scheduling action %s in script %u\n", debugstr_w(action), script);
83 
84  count = package->script_actions_count[script];
85  package->script_actions_count[script]++;
86  if (count != 0) newbuf = msi_realloc( package->script_actions[script],
87  package->script_actions_count[script] * sizeof(WCHAR *) );
88  else newbuf = msi_alloc( sizeof(WCHAR *) );
89 
90  newbuf[count] = strdupW( action );
91  package->script_actions[script] = newbuf;
92  return ERROR_SUCCESS;
93 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static WCHAR * strdupW(const WCHAR *src)
Definition: main.c:92
GLuint GLuint GLsizei count
Definition: gl.h:1545
static void * msi_realloc(void *mem, size_t len) __WINE_ALLOC_SIZE(2)
Definition: msipriv.h:1216
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
script
Definition: msipriv.h:374
#define TRACE(s)
Definition: solgame.cpp:4
LPWSTR * script_actions[SCRIPT_MAX]
Definition: msipriv.h:415
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * action
Definition: action.c:7783
int script_actions_count[SCRIPT_MAX]
Definition: msipriv.h:416
unsigned int UINT
Definition: ndis.h:50
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204

Referenced by ACTION_HandleStandardAction(), and defer_custom_action().

◆ release_custom_action_data()

static void release_custom_action_data ( msi_custom_action_info info)
static

Definition at line 391 of file custom.c.

392 {
394 
395  if (!--info->refs)
396  {
397  list_remove( &info->entry );
398  if (info->handle)
399  CloseHandle( info->handle );
400  msi_free( info->action );
401  msi_free( info->source );
402  msi_free( info->target );
403  msiobj_release( &info->package->hdr );
404  msi_free( info );
405  }
406 
408 }
#define CloseHandle
Definition: compat.h:407
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
static CRITICAL_SECTION msi_custom_action_cs
Definition: custom.c:60
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:242
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by ACTION_CallScript(), ACTION_FinishCustomActions(), do_msidbCustomActionTypeDll(), do_msidbCustomActionTypeScript(), mcr_GetActionInfo(), and wait_thread_handle().

◆ ScriptThread()

static DWORD WINAPI ScriptThread ( LPVOID  arg)
static

Definition at line 953 of file custom.c.

954 {
955  LPGUID guid = arg;
956  DWORD rc;
957 
958  TRACE("custom action (%x) started\n", GetCurrentThreadId() );
959 
960  rc = ACTION_CallScript( guid );
961 
962  TRACE("custom action (%x) returned %i\n", GetCurrentThreadId(), rc );
963 
965  return rc;
966 }
UINT WINAPI MsiCloseAllHandles(void)
Definition: handle.c:326
void * arg
Definition: msvc.h:10
const GUID * guid
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:458
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
static DWORD ACTION_CallScript(const GUID *guid)
Definition: custom.c:924

Referenced by do_msidbCustomActionTypeScript().

◆ set_deferred_action_props()

static void set_deferred_action_props ( MSIPACKAGE package,
const WCHAR deferred_data 
)
static

Definition at line 185 of file custom.c.

186 {
187  static const WCHAR sep[] = {'<','=','>',0};
188  const WCHAR *end, *beg = deferred_data + 1;
189 
190  end = strstrW(beg, sep);
191  msi_set_property( package->db, szCustomActionData, beg, end - beg );
192  beg = end + 3;
193 
194  end = strstrW(beg, sep);
195  msi_set_property( package->db, szUserSID, beg, end - beg );
196  beg = end + 3;
197 
198  end = strchrW(beg, ']');
199  msi_set_property( package->db, szProductCode, beg, end - beg );
200 }
static const WCHAR szUserSID[]
Definition: msipriv.h:1126
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
GLuint GLuint end
Definition: gl.h:1545
#define strstrW(d, s)
Definition: unicode.h:32
static const WCHAR szProductCode[]
Definition: msipriv.h:1127
__wchar_t WCHAR
Definition: xmlstorage.h:180
MSIDATABASE * db
Definition: msipriv.h:386
UINT msi_set_property(MSIDATABASE *, const WCHAR *, const WCHAR *, int) DECLSPEC_HIDDEN
Definition: package.c:2149
static const WCHAR szCustomActionData[]
Definition: msipriv.h:1139

Referenced by ACTION_CustomAction().

◆ wait_process_handle()

static UINT wait_process_handle ( MSIPACKAGE package,
UINT  type,
HANDLE  ProcessHandle,
LPCWSTR  name 
)
static

Definition at line 350 of file custom.c.

352 {
353  UINT rc = ERROR_SUCCESS;
354 
356  {
357  TRACE("waiting for %s\n", debugstr_w(name));
358 
360 
363 
365  }
366  else
367  {
368  TRACE("%s running in background\n", debugstr_w(name));
369 
372  else
374  }
375 
376  return rc;
377 }
#define TRUE
Definition: types.h:120
static UINT custom_get_process_return(HANDLE process)
Definition: custom.c:315
#define CloseHandle
Definition: compat.h:407
#define ERROR_SUCCESS
Definition: deptool.c:10
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
static void file_running_action(MSIPACKAGE *package, HANDLE Handle, BOOL process, LPCWSTR name)
Definition: custom.c:301
unsigned int UINT
Definition: ndis.h:50
Definition: name.c:38
_In_ HANDLE ProcessHandle
Definition: mmfuncs.h:403
void msi_dialog_check_messages(HANDLE handle)
Definition: dialog.c:3979

Referenced by HANDLE_CustomType18(), HANDLE_CustomType2(), HANDLE_CustomType23(), HANDLE_CustomType34(), and HANDLE_CustomType50().

◆ wait_thread_handle()

static UINT wait_thread_handle ( msi_custom_action_info info)
static

Definition at line 416 of file custom.c.

417 {
418  UINT rc = ERROR_SUCCESS;
419 
420  if (!(info->type & msidbCustomActionTypeAsync))
421  {
422  TRACE("waiting for %s\n", debugstr_w( info->action ));
423 
424  msi_dialog_check_messages( info->handle );
425 
426  if (!(info->type & msidbCustomActionTypeContinue))
427  rc = custom_get_thread_return( info->package, info->handle );
428 
430  }
431  else
432  {
433  TRACE("%s running in background\n", debugstr_w( info->action ));
434  }
435 
436  return rc;
437 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
static UINT custom_get_thread_return(MSIPACKAGE *package, HANDLE thread)
Definition: custom.c:326
unsigned int UINT
Definition: ndis.h:50
static void release_custom_action_data(msi_custom_action_info *info)
Definition: custom.c:391
void msi_dialog_check_messages(HANDLE handle)
Definition: dialog.c:3979

Referenced by HANDLE_CustomType1(), HANDLE_CustomType17(), HANDLE_CustomType21_22(), HANDLE_CustomType37_38(), HANDLE_CustomType53_54(), and HANDLE_CustomType5_6().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( msi  )

Variable Documentation

◆ msi_custom_action_cs

◆ msi_custom_action_cs_debug

CRITICAL_SECTION_DEBUG msi_custom_action_cs_debug
static
Initial value:
=
{
0, 0, { (DWORD_PTR)(__FILE__ ": msi_custom_action_cs") }
}
#define DWORD_PTR
Definition: treelist.c:76
static CRITICAL_SECTION msi_custom_action_cs
Definition: custom.c:60
LIST_ENTRY ProcessLocksList
Definition: winbase.h:861
static CRITICAL_SECTION_DEBUG msi_custom_action_cs_debug
Definition: custom.c:61

Definition at line 61 of file custom.c.

◆ msi_custom_remote_vtbl

const IWineMsiRemoteCustomActionVtbl msi_custom_remote_vtbl
static
Initial value:
=
{
}
static ULONG WINAPI mcr_AddRef(IWineMsiRemoteCustomAction *iface)
Definition: custom.c:1417
static HRESULT WINAPI mcr_QueryInterface(IWineMsiRemoteCustomAction *iface, REFIID riid, LPVOID *ppobj)
Definition: custom.c:1403
static ULONG WINAPI mcr_Release(IWineMsiRemoteCustomAction *iface)
Definition: custom.c:1424
static HRESULT WINAPI mcr_GetActionInfo(IWineMsiRemoteCustomAction *iface, LPCGUID custom_action_guid, INT *type, MSIHANDLE *handle, BSTR *dll, BSTR *func, IWineMsiRemotePackage **remote_package)
Definition: custom.c:1435

Definition at line 1453 of file custom.c.

Referenced by create_msi_custom_remote().

◆ msi_pending_custom_actions

struct list msi_pending_custom_actions = LIST_INIT( msi_pending_custom_actions )
static