ReactOS  0.4.15-dev-4853-g3a72a52
custom.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "ntstatus.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 "winemsi_s.h"
#include "wine/asm.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
 

Macros

#define COBJMACROS
 
#define WIN32_NO_STATUS
 
#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
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (msi)
 
void __RPC_FAR *__RPC_USER MIDL_user_allocate (SIZE_T len)
 
void __RPC_USER MIDL_user_free (void __RPC_FAR *ptr)
 
LONG WINAPI rpc_filter (EXCEPTION_POINTERS *eptr)
 
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)
 
static MSIBINARYget_temp_binary (MSIPACKAGE *package, LPCWSTR source)
 
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 free_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 (const WCHAR *action)
 
static UINT custom_proc_wrapper (MsiCustomActionEntryPoint entry, MSIHANDLE hinst)
 
UINT CDECL __wine_msi_call_dll_function (DWORD client_pid, const GUID *guid)
 
static HANDLE get_admin_token (void)
 
static DWORD custom_start_server (MSIPACKAGE *package, DWORD arch)
 
void custom_stop_server (HANDLE process, HANDLE pipe)
 
static DWORD WINAPI custom_client_thread (void *arg)
 
static BOOL get_binary_type (const WCHAR *name, DWORD *type)
 
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 WCHARbuild_msiexec_args (const WCHAR *filename, const WCHAR *params)
 
static UINT HANDLE_CustomType23 (MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
 
static UINT write_substorage_to_file (MSIPACKAGE *package, const WCHAR *source, const WCHAR *filename)
 
static UINT HANDLE_CustomType7 (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, const WCHAR *action)
 
void ACTION_FinishCustomActions (const MSIPACKAGE *package)
 
UINT __cdecl s_remote_GetActionInfo (const GUID *guid, WCHAR **name, int *type, WCHAR **dll, char **func, MSIHANDLE *hinst)
 

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 )
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file custom.c.

◆ CUSTOM_ACTION_TYPE_MASK

#define CUSTOM_ACTION_TYPE_MASK   0x3F

Definition at line 51 of file custom.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 27 of file custom.c.

Typedef Documentation

◆ msi_custom_action_info

◆ MsiCustomActionEntryPoint

typedef UINT(WINAPI * MsiCustomActionEntryPoint) (MSIHANDLE)

Definition at line 61 of file custom.c.

◆ MSIRUNNINGACTION

Function Documentation

◆ __wine_msi_call_dll_function()

UINT CDECL __wine_msi_call_dll_function ( DWORD  client_pid,
const GUID guid 
)

Definition at line 507 of file custom.c.

508 {
510  MSIHANDLE remote_package = 0;
511  RPC_WSTR binding_str;
512  MSIHANDLE hPackage;
514  WCHAR *dll = NULL, *action = NULL;
515  LPSTR proc = NULL;
516  HANDLE hModule;
517  INT type;
518  UINT r;
519 
520  TRACE("%s\n", debugstr_guid( guid ));
521 
522  if (!rpc_handle)
523  {
524  WCHAR endpoint[12];
525 
527  status = RpcStringBindingComposeW(NULL, (WCHAR *)L"ncalrpc", NULL, endpoint, NULL, &binding_str);
528  if (status != RPC_S_OK)
529  {
530  ERR("RpcStringBindingCompose failed: %#lx\n", status);
531  return status;
532  }
533  status = RpcBindingFromStringBindingW(binding_str, &rpc_handle);
534  if (status != RPC_S_OK)
535  {
536  ERR("RpcBindingFromStringBinding failed: %#lx\n", status);
537  return status;
538  }
539  RpcStringFreeW(&binding_str);
540  }
541 
542  r = remote_GetActionInfo(guid, &action, &type, &dll, &proc, &remote_package);
543  if (r != ERROR_SUCCESS)
544  return r;
545 
546  hPackage = alloc_msi_remote_handle( remote_package );
547  if (!hPackage)
548  {
549  ERR( "failed to create handle for %#lx\n", remote_package );
551  midl_user_free( dll );
552  midl_user_free( proc );
553  return ERROR_INSTALL_FAILURE;
554  }
555 
556  hModule = LoadLibraryW( dll );
557  if (!hModule)
558  {
559  ERR( "failed to load dll %s (%lu)\n", debugstr_w( dll ), GetLastError() );
561  midl_user_free( dll );
562  midl_user_free( proc );
563  MsiCloseHandle( hPackage );
564  return ERROR_SUCCESS;
565  }
566 
568  if (!fn) WARN( "GetProcAddress(%s) failed\n", debugstr_a(proc) );
569  else
570  {
572 
573  __TRY
574  {
575  r = custom_proc_wrapper( fn, hPackage );
576  }
578  {
579  ERR( "Custom action (%s:%s) caused a page fault: %#lx\n",
581  r = ERROR_SUCCESS;
582  }
583  __ENDTRY;
584  }
585 
587 
591 
593  return r;
594 }
RPC_STATUS WINAPI RpcBindingFromStringBindingW(RPC_WSTR StringBinding, RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:876
#define midl_user_free
Definition: rpc.h:45
UINT WINAPI MsiCloseAllHandles(void)
Definition: handle.c:325
#define ERROR_SUCCESS
Definition: deptool.c:10
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR *String)
Definition: rpcrt4_main.c:174
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define WARN(fmt,...)
Definition: debug.h:112
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
static HANDLE proc()
Definition: pdb.c:34
unsigned short * RPC_WSTR
Definition: rpcdce.h:46
char * LPSTR
Definition: xmlstorage.h:182
int32_t INT
Definition: typedefs.h:58
RPC_STATUS WINAPI RpcStringBindingComposeW(RPC_WSTR ObjUuid, RPC_WSTR Protseq, RPC_WSTR NetworkAddr, RPC_WSTR Endpoint, RPC_WSTR Options, RPC_WSTR *StringBinding)
Definition: rpc_binding.c:510
static void handle_msi_break(const WCHAR *action)
Definition: custom.c:458
UINT(WINAPI * MsiCustomActionEntryPoint)(MSIHANDLE)
Definition: custom.c:61
static HMODULE dll
Definition: str.c:188
long RPC_STATUS
Definition: rpc.h:52
const GUID * guid
#define L(x)
Definition: ntvdm.h:50
unsigned long MSIHANDLE
Definition: winemsi.idl:24
#define debugstr_w
Definition: kernel32.h:32
#define LoadLibraryW(x)
Definition: compat.h:606
#define __TRY
Definition: compat.h:80
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
#define FreeLibrary(x)
Definition: compat.h:607
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
static UINT custom_proc_wrapper(MsiCustomActionEntryPoint entry, MSIHANDLE hinst)
Definition: custom.c:501
#define ERROR_INSTALL_FAILURE
Definition: winerror.h:961
#define __ENDTRY
Definition: compat.h:82
int _cdecl swprintf(const WCHAR *,...)
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:269
#define ERR(fmt,...)
Definition: debug.h:110
Definition: nis.h:10
const WCHAR * action
Definition: action.c:7479
#define ARRAY_SIZE(a)
Definition: main.h:24
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
static DWORD client_pid
Definition: msiexec.c:386
#define GetProcAddress(x, y)
Definition: compat.h:612
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define GetExceptionCode()
Definition: seh.h:27
static SERVICE_STATUS status
Definition: service.c:31
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:81
#define RPC_S_OK
Definition: rpcnterr.h:22
MSIHANDLE alloc_msi_remote_handle(MSIHANDLE remote)
Definition: handle.c:135
HMODULE hModule
Definition: animate.c:44
Definition: ps.c:97

Referenced by custom_action_thread().

◆ ACTION_CallScript()

static DWORD ACTION_CallScript ( const GUID guid)
static

Definition at line 1197 of file custom.c.

1198 {
1200  MSIHANDLE hPackage;
1202 
1204  if (!info)
1205  {
1206  ERR("failed to find action %s\n", debugstr_guid( guid) );
1207  return ERROR_FUNCTION_FAILED;
1208  }
1209 
1210  TRACE("function %s, script %s\n", debugstr_w( info->target ), debugstr_w( info->source ) );
1211 
1212  hPackage = alloc_msihandle( &info->package->hdr );
1213  if (hPackage)
1214  {
1215  r = call_script( hPackage, info->type, info->source, info->target, info->action );
1216  TRACE("script returned %u\n", r);
1217  MsiCloseHandle( hPackage );
1218  }
1219  else
1220  ERR("failed to create handle for %p\n", info->package );
1221 
1222  return r;
1223 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
const GUID * guid
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
static struct _test_info info[]
Definition: SetCursorPos.c:19
unsigned long MSIHANDLE
Definition: winemsi.idl:24
#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:288
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:269
#define ERR(fmt,...)
Definition: debug.h:110
MSIHANDLE alloc_msihandle(MSIOBJECTHDR *obj)
Definition: handle.c:111
unsigned int UINT
Definition: ndis.h:50
static msi_custom_action_info * find_action_by_guid(const GUID *guid)
Definition: custom.c:434

Referenced by ScriptThread().

◆ ACTION_CustomAction()

UINT ACTION_CustomAction ( MSIPACKAGE package,
const WCHAR action 
)

Definition at line 1460 of file custom.c.

1461 {
1462  UINT rc = ERROR_SUCCESS;
1463  MSIRECORD *row;
1464  UINT type;
1465  const WCHAR *source, *target, *ptr, *deferred_data = NULL;
1466  WCHAR *deformated = NULL;
1467  int len;
1468 
1469  /* deferred action: [properties]Action */
1470  if ((ptr = wcsrchr(action, ']')))
1471  {
1472  deferred_data = action;
1473  action = ptr + 1;
1474  }
1475 
1476  row = MSI_QueryGetRecord( package->db, L"SELECT * FROM `CustomAction` WHERE `Action` = '%s'", action );
1477  if (!row)
1479 
1483 
1484  TRACE("Handling custom action %s (%x %s %s)\n",debugstr_w(action),type,
1486 
1487  /* handle some of the deferred actions */
1489  FIXME("msidbCustomActionTypeTSAware not handled\n");
1490 
1492  {
1494  WARN("msidbCustomActionTypeNoImpersonate not handled\n");
1495 
1496  if (!action_type_matches_script(type, package->script))
1497  {
1498  rc = defer_custom_action( package, action, type );
1499  goto end;
1500  }
1501  else
1502  {
1503  LPWSTR actiondata = msi_dup_property( package->db, action );
1504 
1506  package->scheduled_action_running = TRUE;
1507 
1509  package->commit_action_running = TRUE;
1510 
1512  package->rollback_action_running = TRUE;
1513 
1514  if (deferred_data)
1515  set_deferred_action_props(package, deferred_data);
1516  else if (actiondata)
1517  msi_set_property( package->db, L"CustomActionData", actiondata, -1 );
1518  else
1519  msi_set_property( package->db, L"CustomActionData", L"", -1 );
1520 
1521  msi_free(actiondata);
1522  }
1523  }
1524  else if (!check_execution_scheduling_options(package,action,type))
1525  {
1526  rc = ERROR_SUCCESS;
1527  goto end;
1528  }
1529 
1530  switch (type & CUSTOM_ACTION_TYPE_MASK)
1531  {
1532  case 1: /* DLL file stored in a Binary table stream */
1533  rc = HANDLE_CustomType1( package, source, target, type, action );
1534  break;
1535  case 2: /* EXE file stored in a Binary table stream */
1536  rc = HANDLE_CustomType2( package, source, target, type, action );
1537  break;
1538  case 5:
1539  case 6: /* JScript/VBScript file stored in a Binary table stream */
1540  rc = HANDLE_CustomType5_6( package, source, target, type, action );
1541  break;
1542  case 7: /* Concurrent install from substorage */
1543  deformat_string( package, target, &deformated );
1544  rc = HANDLE_CustomType7( package, source, target, type, action );
1545  msi_free( deformated );
1546  break;
1547  case 17:
1548  rc = HANDLE_CustomType17( package, source, target, type, action );
1549  break;
1550  case 18: /* EXE file installed with package */
1551  rc = HANDLE_CustomType18( package, source, target, type, action );
1552  break;
1553  case 19: /* Error that halts install */
1554  rc = HANDLE_CustomType19( package, source, target, type, action );
1555  break;
1556  case 21: /* JScript/VBScript file installed with the product */
1557  case 22:
1558  rc = HANDLE_CustomType21_22( package, source, target, type, action );
1559  break;
1560  case 23: /* Installs another package in the source tree */
1561  deformat_string( package, target, &deformated );
1562  rc = HANDLE_CustomType23( package, source, deformated, type, action );
1563  msi_free( deformated );
1564  break;
1565  case 34: /* EXE to be run in specified directory */
1566  rc = HANDLE_CustomType34( package, source, target, type, action );
1567  break;
1568  case 35: /* Directory set with formatted text */
1569  deformat_string( package, target, &deformated );
1570  MSI_SetTargetPathW( package, source, deformated );
1571  msi_free( deformated );
1572  break;
1573  case 37: /* JScript/VBScript text stored in target column */
1574  case 38:
1575  rc = HANDLE_CustomType37_38( package, source, target, type, action );
1576  break;
1577  case 50: /* EXE file specified by a property value */
1578  rc = HANDLE_CustomType50( package, source, target, type, action );
1579  break;
1580  case 51: /* Property set with formatted text */
1581  if (!source) break;
1582  len = deformat_string( package, target, &deformated );
1583  rc = msi_set_property( package->db, source, deformated, len );
1584  if (rc == ERROR_SUCCESS && !wcscmp( source, L"SourceDir" )) msi_reset_source_folders( package );
1585  msi_free( deformated );
1586  break;
1587  case 53: /* JScript/VBScript text specified by a property value */
1588  case 54:
1589  rc = HANDLE_CustomType53_54( package, source, target, type, action );
1590  break;
1591  default:
1592  FIXME( "unhandled action type %u (%s %s)\n", type & CUSTOM_ACTION_TYPE_MASK, debugstr_w(source),
1593  debugstr_w(target) );
1594  }
1595 
1596 end:
1597  package->scheduled_action_running = FALSE;
1598  package->commit_action_running = FALSE;
1599  package->rollback_action_running = FALSE;
1600  msiobj_release(&row->hdr);
1601  return rc;
1602 }
static UINT HANDLE_CustomType17(MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
Definition: custom.c:963
static BOOL check_execution_scheduling_options(MSIPACKAGE *package, LPCWSTR action, UINT options)
Definition: custom.c:142
static UINT HANDLE_CustomType18(MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
Definition: custom.c:983
#define CUSTOM_ACTION_TYPE_MASK
Definition: custom.c:51
enum script script
Definition: msipriv.h:432
#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:1389
#define TRUE
Definition: types.h:120
#define WARN(fmt,...)
Definition: debug.h:112
static void msi_free(void *mem)
Definition: msipriv.h:1159
static UINT HANDLE_CustomType1(MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
Definition: custom.c:861
static UINT HANDLE_CustomType19(MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
Definition: custom.c:1001
#define L(x)
Definition: ntvdm.h:50
static UINT HANDLE_CustomType34(MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
Definition: custom.c:1174
#define FALSE
Definition: types.h:117
#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:468
#define ERROR_FUNCTION_NOT_CALLED
Definition: winerror.h:984
const WCHAR * MSI_RecordGetString(const MSIRECORD *, UINT) DECLSPEC_HIDDEN
Definition: record.c:433
static void set_deferred_action_props(MSIPACKAGE *package, const WCHAR *deferred_data)
Definition: custom.c:199
static UINT HANDLE_CustomType50(MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
Definition: custom.c:1156
unsigned char commit_action_running
Definition: msipriv.h:467
MSIRECORD *WINAPIV MSI_QueryGetRecord(MSIDATABASE *db, LPCWSTR query,...) DECLSPEC_HIDDEN
Definition: msiquery.c:201
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:564
__wchar_t WCHAR
Definition: xmlstorage.h:180
MSIDATABASE * db
Definition: msipriv.h:394
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:241
static UINT HANDLE_CustomType2(MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
Definition: custom.c:944
GLuint GLuint end
Definition: gl.h:1545
static UINT defer_custom_action(MSIPACKAGE *package, const WCHAR *action, UINT type)
Definition: custom.c:1423
static UINT HANDLE_CustomType5_6(MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
Definition: custom.c:1282
GLenum GLsizei len
Definition: glext.h:6722
#define wcsrchr
Definition: compat.h:16
unsigned char scheduled_action_running
Definition: msipriv.h:466
static UINT HANDLE_CustomType23(MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
Definition: custom.c:1043
static UINT HANDLE_CustomType7(MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
Definition: custom.c:1122
int MSI_RecordGetInteger(MSIRECORD *, UINT) DECLSPEC_HIDDEN
Definition: record.c:213
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
const WCHAR * action
Definition: action.c:7479
GLsizei GLsizei GLchar * source
Definition: glext.h:6048
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
UINT msi_set_property(MSIDATABASE *, const WCHAR *, const WCHAR *, int) DECLSPEC_HIDDEN
Definition: package.c:2044
static BOOL action_type_matches_script(UINT type, UINT script)
Definition: custom.c:1405
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:1330
static UINT HANDLE_CustomType37_38(MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action)
Definition: custom.c:1271
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
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
LPWSTR msi_dup_property(MSIDATABASE *db, LPCWSTR prop) DECLSPEC_HIDDEN
Definition: package.c:2227
void msi_reset_source_folders(MSIPACKAGE *package) DECLSPEC_HIDDEN
Definition: package.c:2033

Referenced by ACTION_HandleCustomAction().

◆ ACTION_FinishCustomActions()

void ACTION_FinishCustomActions ( const MSIPACKAGE package)

Definition at line 1604 of file custom.c.

1605 {
1606  struct list *item;
1607  HANDLE *wait_handles;
1608  unsigned int handle_count, i;
1610 
1611  while ((item = list_head( &package->RunningActions )))
1612  {
1614 
1615  list_remove( &action->entry );
1616 
1617  TRACE("waiting for %s\n", debugstr_w( action->name ) );
1618  msi_dialog_check_messages( action->handle );
1619 
1620  CloseHandle( action->handle );
1621  msi_free( action->name );
1622  msi_free( action );
1623  }
1624 
1626 
1627  handle_count = list_count( &msi_pending_custom_actions );
1628  wait_handles = msi_alloc( handle_count * sizeof(HANDLE) );
1629 
1630  handle_count = 0;
1632  {
1633  if (info->package == package )
1634  {
1635  if (DuplicateHandle(GetCurrentProcess(), info->handle, GetCurrentProcess(), &wait_handles[handle_count], SYNCHRONIZE, FALSE, 0))
1636  handle_count++;
1637  }
1638  }
1639 
1641 
1642  for (i = 0; i < handle_count; i++)
1643  {
1644  msi_dialog_check_messages( wait_handles[i] );
1645  CloseHandle( wait_handles[i] );
1646  }
1647  msi_free( wait_handles );
1648 
1651  {
1652  if (info->package == package)
1654  }
1656 }
#define CloseHandle
Definition: compat.h:598
struct list RunningActions
Definition: msipriv.h:440
static void msi_free(void *mem)
Definition: msipriv.h:1159
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
Definition: list.h:131
#define FALSE
Definition: types.h:117
__WINE_SERVER_LIST_INLINE unsigned int list_count(const struct list *list)
Definition: list.h:155
static struct _test_info info[]
Definition: SetCursorPos.c:19
#define debugstr_w
Definition: kernel32.h:32
static void free_custom_action_data(msi_custom_action_info *info)
Definition: custom.c:395
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define TRACE(s)
Definition: solgame.cpp:4
static CRITICAL_SECTION msi_custom_action_cs
Definition: custom.c:63
uint32_t entry
Definition: isohybrid.c:63
#define GetCurrentProcess()
Definition: compat.h:618
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:7479
static ATOM item
Definition: dde.c:856
const char cursor[]
Definition: icontest.c:13
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
static struct list msi_pending_custom_actions
Definition: custom.c:73
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1142
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define LIST_ENTRY(type)
Definition: queue.h:175
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:4052

Referenced by MSI_InstallPackage().

◆ action_type_matches_script()

static BOOL action_type_matches_script ( UINT  type,
UINT  script 
)
static

Definition at line 1405 of file custom.c.

1406 {
1407  switch (script)
1408  {
1409  case SCRIPT_NONE:
1410  return FALSE;
1411  case SCRIPT_INSTALL:
1413  case SCRIPT_COMMIT:
1414  return (type & msidbCustomActionTypeCommit);
1415  case SCRIPT_ROLLBACK:
1417  default:
1418  ERR("unhandled script %u\n", script);
1419  }
1420  return FALSE;
1421 }
#define FALSE
Definition: types.h:117
script
Definition: msipriv.h:382
#define ERR(fmt,...)
Definition: debug.h:110
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545

Referenced by ACTION_CustomAction().

◆ build_msiexec_args()

static WCHAR* build_msiexec_args ( const WCHAR filename,
const WCHAR params 
)
static

Definition at line 1026 of file custom.c.

1027 {
1028  UINT len_filename = lstrlenW( filename ), len_params = lstrlenW( params );
1029  UINT len = ARRAY_SIZE(L"/qb /i ") - 1;
1030  WCHAR *ret;
1031 
1032  if (!(ret = msi_alloc( (len + len_filename + len_params + 4) * sizeof(WCHAR) ))) return NULL;
1033  memcpy( ret, L"/qb /i ", sizeof(L"/qb /i ") );
1034  ret[len++] = '"';
1035  memcpy( ret + len, filename, len_filename * sizeof(WCHAR) );
1036  len += len_filename;
1037  ret[len++] = '"';
1038  ret[len++] = ' ';
1039  lstrcpyW( ret + len, params );
1040  return ret;
1041 }
const char * filename
Definition: ioapi.h:135
#define lstrlenW
Definition: compat.h:609
#define L(x)
Definition: ntvdm.h:50
GLenum const GLfloat * params
Definition: glext.h:5645
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define lstrcpyW
Definition: compat.h:608
#define ARRAY_SIZE(a)
Definition: main.h:24
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1142

Referenced by HANDLE_CustomType23(), and HANDLE_CustomType7().

◆ check_execution_scheduling_options()

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

Definition at line 142 of file custom.c.

143 {
146  {
147  if (!(package->InWhatSequence & SEQUENCE_UI &&
148  package->InWhatSequence & SEQUENCE_EXEC))
149  {
150  TRACE("Skipping action due to dbCustomActionTypeClientRepeat option.\n");
151  return FALSE;
152  }
153  }
155  {
156  if (package->InWhatSequence & SEQUENCE_UI &&
157  package->InWhatSequence & SEQUENCE_EXEC )
158  {
159  TRACE("Skipping action due to msidbCustomActionTypeFirstSequence option.\n");
160  return FALSE;
161  }
162  }
164  {
165  if (msi_action_is_unique(package, action))
166  {
167  TRACE("Skipping action due to msidbCustomActionTypeOncePerProcess option.\n");
168  return FALSE;
169  }
170  else
172  }
173 
174  return TRUE;
175 }
#define TRUE
Definition: types.h:120
BOOL msi_action_is_unique(const MSIPACKAGE *package, const WCHAR *action)
Definition: custom.c:131
#define FALSE
Definition: types.h:117
#define SEQUENCE_EXEC
Definition: msipriv.h:719
#define TRACE(s)
Definition: solgame.cpp:4
UINT InWhatSequence
Definition: msipriv.h:438
const WCHAR * action
Definition: action.c:7479
#define SEQUENCE_UI
Definition: msipriv.h:718
UINT msi_register_unique_action(MSIPACKAGE *package, const WCHAR *action)
Definition: custom.c:113

Referenced by ACTION_CustomAction().

◆ create_temp_binary()

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

Definition at line 244 of file custom.c.

245 {
246  MSIRECORD *row;
247  MSIBINARY *binary = NULL;
248  HANDLE file;
249  CHAR buffer[1024];
250  WCHAR *tmpfile;
251  DWORD sz, write;
252  UINT r;
253 
254  if (!(tmpfile = msi_create_temp_file( package->db ))) return NULL;
255 
256  if (!(row = MSI_QueryGetRecord( package->db, L"SELECT * FROM `Binary` WHERE `Name` = '%s'", source ))) goto error;
257  if (!(binary = msi_alloc_zero( sizeof(MSIBINARY) ))) goto error;
258 
260  if (file == INVALID_HANDLE_VALUE) goto error;
261 
262  do
263  {
264  sz = sizeof(buffer);
265  r = MSI_RecordReadStream( row, 2, buffer, &sz );
266  if (r != ERROR_SUCCESS)
267  {
268  ERR("Failed to get stream\n");
269  break;
270  }
271  WriteFile( file, buffer, sz, &write, NULL );
272  } while (sz == sizeof buffer);
273 
274  CloseHandle( file );
275  if (r != ERROR_SUCCESS) goto error;
276 
277  binary->source = strdupW( source );
278  binary->tmpfile = tmpfile;
279  list_add_tail( &package->binaries, &binary->entry );
280 
281  msiobj_release( &row->hdr );
282  return binary;
283 
284 error:
285  if (row) msiobj_release( &row->hdr );
286  DeleteFileW( tmpfile );
287  msi_free( tmpfile );
288  msi_free( binary );
289  return NULL;
290 }
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:598
#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:590
GLuint buffer
Definition: glext.h:5915
static void msi_free(void *mem)
Definition: msipriv.h:1159
static void * msi_alloc_zero(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1148
__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 L(x)
Definition: ntvdm.h:50
#define GENERIC_WRITE
Definition: nt_native.h:90
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
struct list binaries
Definition: msipriv.h:407
#define OPEN_EXISTING
Definition: compat.h:634
MSIRECORD *WINAPIV MSI_QueryGetRecord(MSIDATABASE *db, LPCWSTR query,...) DECLSPEC_HIDDEN
Definition: msiquery.c:201
_Check_return_ _CRTIMP FILE *__cdecl tmpfile(void)
Definition: file.c:3912
__wchar_t WCHAR
Definition: xmlstorage.h:180
const char file[]
Definition: icontest.c:11
unsigned long DWORD
Definition: ntddk_ex.h:95
MSIDATABASE * db
Definition: msipriv.h:394
const GLuint GLenum const GLvoid * binary
Definition: glext.h:7538
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:241
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define ERR(fmt,...)
Definition: debug.h:110
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define CreateFileW
Definition: compat.h:600
UINT MSI_RecordReadStream(MSIRECORD *, UINT, char *, LPDWORD) DECLSPEC_HIDDEN
Definition: record.c:761
WCHAR * msi_create_temp_file(MSIDATABASE *db)
Definition: custom.c:215
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_client_thread()

static DWORD WINAPI custom_client_thread ( void arg)
static

Definition at line 691 of file custom.c.

692 {
694  DWORD64 thread64;
695  HANDLE process;
696  HANDLE thread;
697  HANDLE pipe;
698  DWORD size;
699  DWORD rc;
700 
701  CoInitializeEx(NULL, COINIT_MULTITHREADED); /* needed to marshal streams */
702 
703  if (info->arch == SCS_32BIT_BINARY)
704  {
705  process = info->package->custom_server_32_process;
706  pipe = info->package->custom_server_32_pipe;
707  }
708  else
709  {
710  process = info->package->custom_server_64_process;
711  pipe = info->package->custom_server_64_pipe;
712  }
713 
715 
716  if (!WriteFile(pipe, &info->guid, sizeof(info->guid), &size, NULL) ||
717  size != sizeof(info->guid))
718  {
719  ERR("failed to write to custom action client pipe: %lu\n", GetLastError());
721  return GetLastError();
722  }
723  if (!ReadFile(pipe, &thread64, sizeof(thread64), &size, NULL) || size != sizeof(thread64))
724  {
725  ERR("failed to read from custom action client pipe: %lu\n", GetLastError());
727  return GetLastError();
728  }
729 
731 
734  {
738  }
739  else
740  rc = GetLastError();
741 
742  CoUninitialize();
743  return rc;
744 }
#define SCS_32BIT_BINARY
Definition: winbase.h:233
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 DUPLICATE_CLOSE_SOURCE
#define CloseHandle
Definition: compat.h:598
static HANDLE process
Definition: process.c:76
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
void * arg
Definition: msvc.h:10
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
BOOL WINAPI GetExitCodeThread(IN HANDLE hThread, OUT LPDWORD lpExitCode)
Definition: thread.c:541
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define DUPLICATE_SAME_ACCESS
#define FALSE
Definition: types.h:117
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
static CRITICAL_SECTION msi_custom_action_cs
Definition: custom.c:63
static HANDLE thread
Definition: service.c:33
#define GetCurrentProcess()
Definition: compat.h:618
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define ERR(fmt,...)
Definition: debug.h:110
uint64_t DWORD64
Definition: typedefs.h:67
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:2002
#define ReadFile(a, b, c, d, e)
Definition: compat.h:601
#define NULL
Definition: types.h:112
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define INFINITE
Definition: serial.h:102
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

Referenced by do_msidbCustomActionTypeDll().

◆ custom_get_process_return()

static UINT custom_get_process_return ( HANDLE  process)
static

Definition at line 319 of file custom.c.

320 {
321  DWORD rc = 0;
322 
323  GetExitCodeProcess( process, &rc );
324  TRACE( "exit code is %lu\n", rc );
325  if (rc != 0)
326  return ERROR_FUNCTION_FAILED;
327  return ERROR_SUCCESS;
328 }
#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 330 of file custom.c.

331 {
332  DWORD rc = 0;
333 
334  GetExitCodeThread( thread, &rc );
335 
336  switch (rc)
337  {
339  case ERROR_SUCCESS:
342  return rc;
343  case ERROR_NO_MORE_ITEMS:
344  return ERROR_SUCCESS;
346  ACTION_ForceReboot( package );
347  return ERROR_SUCCESS;
348  default:
349  ERR( "invalid Return Code %lu\n", rc );
350  return ERROR_INSTALL_FAILURE;
351  }
352 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
UINT ACTION_ForceReboot(MSIPACKAGE *package)
Definition: action.c:5183
BOOL WINAPI GetExitCodeThread(IN HANDLE hThread, OUT LPDWORD lpExitCode)
Definition: thread.c:541
#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().

◆ custom_proc_wrapper()

static UINT custom_proc_wrapper ( MsiCustomActionEntryPoint  entry,
MSIHANDLE  hinst 
)
static

Definition at line 501 of file custom.c.

502 {
503  return entry(hinst);
504 }
uint32_t entry
Definition: isohybrid.c:63
static HINSTANCE hinst
Definition: edit.c:551

Referenced by __wine_msi_call_dll_function().

◆ custom_start_server()

static DWORD custom_start_server ( MSIPACKAGE package,
DWORD  arch 
)
static

Definition at line 618 of file custom.c.

619 {
621  PROCESS_INFORMATION pi = {0};
622  STARTUPINFOW si = {0};
623  WCHAR buffer[24];
624  HANDLE token;
625  void *cookie;
626  HANDLE pipe;
627 
628  if ((arch == SCS_32BIT_BINARY && package->custom_server_32_process) ||
629  (arch == SCS_64BIT_BINARY && package->custom_server_64_process))
630  return ERROR_SUCCESS;
631 
632  swprintf(buffer, ARRAY_SIZE(buffer), L"\\\\.\\pipe\\msica_%x_%d",
633  GetCurrentProcessId(), arch == SCS_32BIT_BINARY ? 32 : 64);
634  pipe = CreateNamedPipeW(buffer, PIPE_ACCESS_DUPLEX, 0, 1, sizeof(DWORD64),
635  sizeof(GUID), 0, NULL);
636  if (pipe == INVALID_HANDLE_VALUE)
637  ERR("failed to create custom action client pipe: %lu\n", GetLastError());
638 
639  if ((sizeof(void *) == 8 || is_wow64) && arch == SCS_32BIT_BINARY)
640  GetSystemWow64DirectoryW(path, MAX_PATH - ARRAY_SIZE(L"\\msiexec.exe"));
641  else
642  GetSystemDirectoryW(path, MAX_PATH - ARRAY_SIZE(L"\\msiexec.exe"));
643  lstrcatW(path, L"\\msiexec.exe");
644  swprintf(cmdline, ARRAY_SIZE(cmdline), L"%s -Embedding %d", path, GetCurrentProcessId());
645 
647 
648  if (is_wow64 && arch == SCS_64BIT_BINARY)
649  {
653  }
654  else
656 
657  if (token) CloseHandle(token);
658 
659  CloseHandle(pi.hThread);
660 
661  if (arch == SCS_32BIT_BINARY)
662  {
663  package->custom_server_32_process = pi.hProcess;
664  package->custom_server_32_pipe = pipe;
665  }
666  else
667  {
668  package->custom_server_64_process = pi.hProcess;
669  package->custom_server_64_pipe = pipe;
670  }
671 
672  if (!ConnectNamedPipe(pipe, NULL))
673  {
674  ERR("failed to connect to custom action server: %lu\n", GetLastError());
675  return GetLastError();
676  }
677 
678  return ERROR_SUCCESS;
679 }
#define SCS_32BIT_BINARY
Definition: winbase.h:233
BOOL WINAPI Wow64RevertWow64FsRedirection(IN PVOID OldValue)
Definition: utils.c:805
#define CloseHandle
Definition: compat.h:598
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL is_wow64
Definition: msi.c:54
HANDLE custom_server_32_process
Definition: msipriv.h:442
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
GLuint buffer
Definition: glext.h:5915
#define SCS_64BIT_BINARY
Definition: winbase.h:234
TCHAR * cmdline
Definition: stretchblt.cpp:32
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
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 token
Definition: glfuncs.h:210
HANDLE custom_server_64_process
Definition: msipriv.h:443
__wchar_t WCHAR
Definition: xmlstorage.h:180
static refpint_t pi[]
Definition: server.c:96
#define PIPE_ACCESS_DUPLEX
Definition: winbase.h:164
#define MAX_PATH
Definition: compat.h:34
HANDLE custom_server_32_pipe
Definition: msipriv.h:444
UINT WINAPI GetSystemWow64DirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2421
int _cdecl swprintf(const WCHAR *,...)
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessAsUserW(_In_opt_ HANDLE hToken, _In_opt_ LPCWSTR lpApplicationName, _Inout_opt_ LPWSTR lpCommandLine, _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes, _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes, _In_ BOOL bInheritHandles, _In_ DWORD dwCreationFlags, _In_opt_ LPVOID lpEnvironment, _In_opt_ LPCWSTR lpCurrentDirectory, _In_ LPSTARTUPINFOW lpStartupInfo, _Out_ LPPROCESS_INFORMATION lpProcessInformation)
Definition: logon.c:993
#define ERR(fmt,...)
Definition: debug.h:110
uint64_t DWORD64
Definition: typedefs.h:67
#define ARRAY_SIZE(a)
Definition: main.h:24
Definition: cookie.c:33
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2313
#define NULL
Definition: types.h:112
static HANDLE get_admin_token(void)
Definition: custom.c:596
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
HANDLE WINAPI CreateNamedPipeW(LPCWSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: npipe.c:246
HANDLE custom_server_64_pipe
Definition: msipriv.h:445
BOOL WINAPI ConnectNamedPipe(IN HANDLE hNamedPipe, IN LPOVERLAPPED lpOverlapped)
Definition: npipe.c:701
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1158
BOOL WINAPI Wow64DisableWow64FsRedirection(IN PVOID *OldValue)
Definition: utils.c:782

Referenced by do_msidbCustomActionTypeDll().

◆ custom_stop_server()

void custom_stop_server ( HANDLE  process,
HANDLE  pipe 
)

Definition at line 681 of file custom.c.

682 {
683  DWORD size;
684 
685  WriteFile(pipe, &GUID_NULL, sizeof(GUID_NULL), &size, NULL);
688  CloseHandle(pipe);
689 }
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:598
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GUID_NULL
Definition: ks.h:106
#define NULL
Definition: types.h:112
#define INFINITE
Definition: serial.h:102

Referenced by MSI_FreePackage().

◆ defer_custom_action()

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

Definition at line 1423 of file custom.c.

1424 {
1425  WCHAR *actiondata = msi_dup_property( package->db, action );
1426  WCHAR *usersid = msi_dup_property( package->db, L"UserSID" );
1427  WCHAR *prodcode = msi_dup_property( package->db, L"ProductCode" );
1428  WCHAR *deferred = msi_get_deferred_action( action, actiondata, usersid, prodcode );
1429 
1430  if (!deferred)
1431  {
1432  msi_free( actiondata );
1433  msi_free( usersid );
1434  msi_free( prodcode );
1435  return ERROR_OUTOFMEMORY;
1436  }
1438  {
1439  TRACE("deferring commit action\n");
1440  msi_schedule_action( package, SCRIPT_COMMIT, deferred );
1441  }
1443  {
1444  TRACE("deferring rollback action\n");
1445  msi_schedule_action( package, SCRIPT_ROLLBACK, deferred );
1446  }
1447  else
1448  {
1449  TRACE("deferring install action\n");
1450  msi_schedule_action( package, SCRIPT_INSTALL, deferred );
1451  }
1452 
1453  msi_free( actiondata );
1454  msi_free( usersid );
1455  msi_free( prodcode );
1456  msi_free( deferred );
1457  return ERROR_SUCCESS;
1458 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static void msi_free(void *mem)
Definition: msipriv.h:1159
#define L(x)
Definition: ntvdm.h:50
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
MSIDATABASE * db
Definition: msipriv.h:394
static LPWSTR msi_get_deferred_action(LPCWSTR action, LPCWSTR actiondata, LPCWSTR usersid, LPCWSTR prodcode)
Definition: custom.c:181
const WCHAR * action
Definition: action.c:7479
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
UINT msi_schedule_action(MSIPACKAGE *package, UINT script, const WCHAR *action)
Definition: custom.c:90
LPWSTR msi_dup_property(MSIDATABASE *db, LPCWSTR prop) DECLSPEC_HIDDEN
Definition: package.c:2227

Referenced by ACTION_CustomAction().

◆ do_msidbCustomActionTypeDll()

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

Definition at line 791 of file custom.c.

793 {
796  BOOL ret;
797 
798  info = msi_alloc( sizeof *info );
799  if (!info)
800  return NULL;
801 
802  msiobj_addref( &package->hdr );
803  info->package = package;
804  info->type = type;
805  info->target = strdupW( target );
806  info->source = strdupW( source );
807  info->action = strdupW( action );
808  CoCreateGuid( &info->guid );
809 
813 
814  if (!package->rpc_server_started)
815  {
816  WCHAR endpoint[12];
817 
820  endpoint, NULL);
821  if (status != RPC_S_OK)
822  {
823  ERR("RpcServerUseProtseqEp failed: %#lx\n", status);
824  return NULL;
825  }
826 
827  status = RpcServerRegisterIfEx(s_IWineMsiRemote_v0_0_s_ifspec, NULL, NULL,
829  if (status != RPC_S_OK)
830  {
831  ERR("RpcServerRegisterIfEx failed: %#lx\n", status);
832  return NULL;
833  }
834 
835  info->package->rpc_server_started = 1;
836  }
837 
838  ret = get_binary_type(source, &info->arch);
839  if (!ret)
840  info->arch = (sizeof(void *) == 8 ? SCS_64BIT_BINARY : SCS_32BIT_BINARY);
841 
842  if (info->arch == SCS_64BIT_BINARY && sizeof(void *) == 4 && !is_wow64)
843  {
844  ERR("Attempt to run a 64-bit custom action inside a 32-bit WINEPREFIX.\n");
846  return NULL;
847  }
848 
849  custom_start_server(package, info->arch);
850 
851  info->handle = CreateThread(NULL, 0, custom_client_thread, info, 0, NULL);
852  if (!info->handle)
853  {
855  return NULL;
856  }
857 
858  return info;
859 }
void msiobj_addref(MSIOBJECTHDR *info)
Definition: handle.c:217
#define SCS_32BIT_BINARY
Definition: winbase.h:233
BOOL is_wow64
Definition: msi.c:54
MSIOBJECTHDR hdr
Definition: msipriv.h:393
unsigned char rpc_server_started
Definition: msipriv.h:472
static WCHAR * strdupW(const WCHAR *src)
Definition: main.c:92
static BOOL get_binary_type(const WCHAR *name, DWORD *type)
Definition: custom.c:747
#define SCS_64BIT_BINARY
Definition: winbase.h:234
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define RPC_IF_AUTOLISTEN
Definition: rpcdce.h:313
RPC_STATUS WINAPI RpcServerRegisterIfEx(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, RPC_MGR_EPV *MgrEpv, UINT Flags, UINT MaxCalls, RPC_IF_CALLBACK_FN *IfCallbackFn)
Definition: rpc_server.c:1125
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
static DWORD WINAPI custom_client_thread(void *arg)
Definition: custom.c:691
long RPC_STATUS
Definition: rpc.h:52
#define L(x)
Definition: ntvdm.h:50
unsigned int BOOL
Definition: ntddk_ex.h:94
static struct _test_info info[]
Definition: SetCursorPos.c:19
#define RPC_C_LISTEN_MAX_CALLS_DEFAULT
Definition: rpcdce.h:122
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:137
static void free_custom_action_data(msi_custom_action_info *info)
Definition: custom.c:395
__wchar_t WCHAR
Definition: xmlstorage.h:180
static CRITICAL_SECTION msi_custom_action_cs
Definition: custom.c:63
HRESULT WINAPI CoCreateGuid(GUID *pguid)
Definition: compobj.c:2206
int ret
int _cdecl swprintf(const WCHAR *,...)
RPC_STATUS WINAPI RpcServerUseProtseqEpW(RPC_WSTR Protseq, UINT MaxCalls, RPC_WSTR Endpoint, LPVOID SecurityDescriptor)
Definition: rpc_server.c:927
#define ERR(fmt,...)
Definition: debug.h:110
Definition: nis.h:10
const WCHAR * action
Definition: action.c:7479
#define ARRAY_SIZE(a)
Definition: main.h:24
static struct list msi_pending_custom_actions
Definition: custom.c:73
#define RPC_C_PROTSEQ_MAX_REQS_DEFAULT
Definition: rpcdce.h:123
#define NULL
Definition: types.h:112
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1142
GLenum target
Definition: glext.h:7315
static DWORD custom_start_server(MSIPACKAGE *package, DWORD arch)
Definition: custom.c:618
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static SERVICE_STATUS status
Definition: service.c:31
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1158
#define RPC_S_OK
Definition: rpcnterr.h:22
Definition: ps.c:97

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 1240 of file custom.c.

1242 {
1244 
1245  info = msi_alloc( sizeof *info );
1246  if (!info)
1247  return NULL;
1248 
1249  msiobj_addref( &package->hdr );
1250  info->package = package;
1251  info->type = type;
1252  info->target = strdupW( function );
1253  info->source = strdupW( script );
1254  info->action = strdupW( action );
1255  CoCreateGuid( &info->guid );
1256 
1260 
1261  info->handle = CreateThread( NULL, 0, ScriptThread, &info->guid, 0, NULL );
1262  if (!info->handle)
1263  {
1265  return NULL;
1266  }
1267 
1268  return info;
1269 }
void msiobj_addref(MSIOBJECTHDR *info)
Definition: handle.c:217
MSIOBJECTHDR hdr
Definition: msipriv.h:393
static WCHAR * strdupW(const WCHAR *src)
Definition: main.c:92
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
static struct _test_info info[]
Definition: SetCursorPos.c:19
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:137
static void free_custom_action_data(msi_custom_action_info *info)
Definition: custom.c:395
script
Definition: msipriv.h:382
static CRITICAL_SECTION msi_custom_action_cs
Definition: custom.c:63
static DWORD WINAPI ScriptThread(LPVOID arg)
Definition: custom.c:1225
HRESULT WINAPI CoCreateGuid(GUID *pguid)
Definition: compobj.c:2206
const WCHAR * action
Definition: action.c:7479
static struct list msi_pending_custom_actions
Definition: custom.c:73
#define NULL
Definition: types.h:112
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1142
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

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 877 of file custom.c.

878 {
879  STARTUPINFOW si;
881  WCHAR *exe = NULL, *cmd = NULL, *p;
882  BOOL ret;
883 
884  if (app)
885  {
886  int len_arg = 0;
887  DWORD len_exe;
888 
889  if (!(exe = msi_alloc( MAX_PATH * sizeof(WCHAR) ))) return INVALID_HANDLE_VALUE;
890  len_exe = SearchPathW( NULL, app, L".exe", MAX_PATH, exe, NULL );
891  if (len_exe >= MAX_PATH)
892  {
893  msi_free( exe );
894  if (!(exe = msi_alloc( len_exe * sizeof(WCHAR) ))) return INVALID_HANDLE_VALUE;
895  len_exe = SearchPathW( NULL, app, L".exe", len_exe, exe, NULL );
896  }
897  if (!len_exe)
898  {
899  ERR("can't find executable %lu\n", GetLastError());
900  msi_free( exe );
901  return INVALID_HANDLE_VALUE;
902  }
903 
904  if (arg) len_arg = lstrlenW( arg );
905  if (!(cmd = msi_alloc( (len_exe + len_arg + 4) * sizeof(WCHAR) )))
906  {
907  msi_free( exe );
908  return INVALID_HANDLE_VALUE;
909  }
910  p = cmd;
911  if (wcschr( exe, ' ' ))
912  {
913  *p++ = '\"';
914  memcpy( p, exe, len_exe * sizeof(WCHAR) );
915  p += len_exe;
916  *p++ = '\"';
917  *p = 0;
918  }
919  else
920  {
921  lstrcpyW( p, exe );
922  p += len_exe;
923  }
924  if (arg)
925  {
926  *p++ = ' ';
927  memcpy( p, arg, len_arg * sizeof(WCHAR) );
928  p[len_arg] = 0;
929  }
930  }
931  memset( &si, 0, sizeof(STARTUPINFOW) );
932  ret = CreateProcessW( exe, exe ? cmd : arg, NULL, NULL, FALSE, 0, NULL, dir, &si, &info );
933  msi_free( cmd );
934  msi_free( exe );
935  if (!ret)
936  {
937  ERR("unable to execute command %lu\n", GetLastError());
938  return INVALID_HANDLE_VALUE;
939  }
940  CloseHandle( info.hThread );
941  return info.hProcess;
942 }
#define CloseHandle
Definition: compat.h:598
Definition: ftp_var.h:139
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
char * cmd
Definition: vfdcmd.c:85
static void msi_free(void *mem)
Definition: msipriv.h:1159
#define lstrlenW
Definition: compat.h:609
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
static struct _test_info info[]
Definition: SetCursorPos.c:19
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:4594
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
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:1298
#define ERR(fmt,...)
Definition: debug.h:110
#define lstrcpyW
Definition: compat.h:608
#define NULL
Definition: types.h:112
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1142
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(), HANDLE_CustomType50(), and HANDLE_CustomType7().

◆ file_running_action()

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

Definition at line 305 of file custom.c.

307 {
309 
310  action = msi_alloc( sizeof(MSIRUNNINGACTION) );
311 
312  action->handle = Handle;
313  action->process = process;
314  action->name = strdupW(name);
315 
316  list_add_tail( &package->RunningActions, &action->entry );
317 }
static WCHAR * strdupW(const WCHAR *src)
Definition: main.c:92
struct list RunningActions
Definition: msipriv.h:440
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
const WCHAR * action
Definition: action.c:7479
Definition: name.c:38
_In_ HANDLE Handle
Definition: extypes.h:390
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1142

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 434 of file custom.c.

435 {
437  BOOL found = FALSE;
438 
440 
442  {
443  if (IsEqualGUID( &info->guid, guid ))
444  {
445  found = TRUE;
446  break;
447  }
448  }
449 
451 
452  if (!found)
453  return NULL;
454 
455  return info;
456 }
#define TRUE
Definition: types.h:120
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
const GUID * guid
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
static struct _test_info info[]
Definition: SetCursorPos.c:19
static CRITICAL_SECTION msi_custom_action_cs
Definition: custom.c:63
uint32_t entry
Definition: isohybrid.c:63
static struct list msi_pending_custom_actions
Definition: custom.c:73
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by ACTION_CallScript(), and s_remote_GetActionInfo().

◆ free_custom_action_data()

static void free_custom_action_data ( msi_custom_action_info info)
static

Definition at line 395 of file custom.c.

396 {
398 
399  list_remove( &info->entry );
400  if (info->handle)
401  CloseHandle( info->handle );
402  msi_free( info->action );
403  msi_free( info->source );
404  msi_free( info->target );
405  msiobj_release( &info->package->hdr );
406  msi_free( info );
407 
409 }
#define CloseHandle
Definition: compat.h:598
static void msi_free(void *mem)
Definition: msipriv.h:1159
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:63
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:241
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

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

◆ get_admin_token()

static HANDLE get_admin_token ( void  )
static

Definition at line 596 of file custom.c.

597 {
599  TOKEN_LINKED_TOKEN linked;
600  DWORD size;
601 
602 #ifdef __REACTOS__
603 #ifndef GetCurrentThreadEffectiveToken
604 #define GetCurrentProcessToken() ((HANDLE)~(ULONG_PTR)3)
605 #define GetCurrentThreadEffectiveToken() GetCurrentProcessToken()
606 #endif
607 #endif
608 
611  return NULL;
612 
613  if (!GetTokenInformation(GetCurrentThreadEffectiveToken(), TokenLinkedToken, &linked, sizeof(linked), &size))
614  return NULL;
615  return linked.LinkedToken;
616 }
enum _TOKEN_ELEVATION_TYPE TOKEN_ELEVATION_TYPE
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
#define NULL
Definition: types.h:112
#define GetCurrentThreadEffectiveToken()
Definition: security.c:42
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:413
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545

Referenced by custom_start_server().

◆ get_binary_type()

static BOOL get_binary_type ( const WCHAR name,
DWORD type 
)
static

Definition at line 747 of file custom.c.

748 {
749  HANDLE hfile, mapping;
751 
753  if (hfile == INVALID_HANDLE_VALUE)
754  return FALSE;
755 
757  SEC_IMAGE, hfile );
758  CloseHandle( hfile );
759 
760  switch (status)
761  {
762  case STATUS_SUCCESS:
763  {
765 
767  CloseHandle( mapping );
768  if (status) return FALSE;
769  switch (info.Machine)
770  {
774  return TRUE;
778  return TRUE;
779  default:
780  return FALSE;
781  }
782  }
785  return TRUE;
786  default:
787  return FALSE;
788  }
789 }
#define SCS_32BIT_BINARY
Definition: winbase.h:233
#define STATUS_INVALID_IMAGE_WIN_64
Definition: ntstatus.h:901
#define CloseHandle
Definition: compat.h:598
#define IMAGE_FILE_MACHINE_ARM64
Definition: compat.h:129
NTSTATUS NTAPI NtCreateSection(OUT PHANDLE SectionHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN PLARGE_INTEGER MaximumSize OPTIONAL, IN ULONG SectionPageProtection OPTIONAL, IN ULONG AllocationAttributes, IN HANDLE FileHandle OPTIONAL)
Definition: section.c:3454
#define TRUE
Definition: types.h:120
#define SECTION_QUERY
Definition: nt_native.h:1287
LONG NTSTATUS
Definition: precomp.h:26
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
#define SCS_64BIT_BINARY
Definition: winbase.h:234
#define IMAGE_FILE_MACHINE_AMD64
Definition: ntimage.h:17
#define FILE_SHARE_READ
Definition: compat.h:136
#define FALSE
Definition: types.h:117
static struct _test_info info[]
Definition: SetCursorPos.c:19
NTSTATUS NTAPI NtQuerySection(_In_ HANDLE SectionHandle, _In_ SECTION_INFORMATION_CLASS SectionInformationClass, _Out_ PVOID SectionInformation, _In_ SIZE_T SectionInformationLength, _Out_opt_ PSIZE_T ResultLength)
Definition: section.c:3679
#define OPEN_EXISTING
Definition: compat.h:634
#define IMAGE_FILE_MACHINE_I386
Definition: pedump.c:174
GLenum GLenum GLenum GLenum mapping
Definition: glext.h:9031
#define GENERIC_READ
Definition: compat.h:135
#define IMAGE_FILE_MACHINE_ARMNT
Definition: compat.h:127
#define NULL
Definition: types.h:112
#define PAGE_READONLY
Definition: compat.h:138
#define CreateFileW
Definition: compat.h:600
Definition: name.c:38
#define STANDARD_RIGHTS_REQUIRED
Definition: nt_native.h:63
#define SEC_IMAGE
Definition: mmtypes.h:96
#define STATUS_SUCCESS
Definition: shellext.h:65
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by do_msidbCustomActionTypeDll().

◆ get_temp_binary()

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

Definition at line 292 of file custom.c.

293 {
294  MSIBINARY *binary;
295 
297  {
298  if (!wcscmp( binary->source, source ))
299  return binary;
300  }
301 
302  return create_temp_binary(package, source);
303 }
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
struct list binaries
Definition: msipriv.h:407
static MSIBINARY * create_temp_binary(MSIPACKAGE *package, LPCWSTR source)
Definition: custom.c:244
const GLuint GLenum const GLvoid * binary
Definition: glext.h:7538
uint32_t entry
Definition: isohybrid.c:63
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

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 861 of file custom.c.

863 {
865  MSIBINARY *binary;
866 
867  if (!(binary = get_temp_binary(package, source)))
868  return ERROR_FUNCTION_FAILED;
869 
870  TRACE("Calling function %s from %s\n", debugstr_w(target), debugstr_w(binary->tmpfile));
871 
872  if (!(info = do_msidbCustomActionTypeDll( package, type, binary->tmpfile, target, action )))
873  return ERROR_FUNCTION_FAILED;
874  return wait_thread_handle( info );
875 }
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
static struct _test_info info[]
Definition: SetCursorPos.c:19
#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:791
#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:411
const WCHAR * action
Definition: action.c:7479
GLenum target
Definition: glext.h:7315
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static MSIBINARY * get_temp_binary(MSIPACKAGE *package, LPCWSTR source)
Definition: custom.c:292

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 963 of file custom.c.

965 {
967  MSIFILE *file;
968 
969  TRACE("%s %s\n", debugstr_w(source), debugstr_w(target));
970 
971  file = msi_get_loaded_file( package, source );
972  if (!file)
973  {
974  ERR("invalid file key %s\n", debugstr_w( source ));
975  return ERROR_FUNCTION_FAILED;
976  }
977 
978  if (!(info = do_msidbCustomActionTypeDll( package, type, file->TargetPath, target, action )))
979  return ERROR_FUNCTION_FAILED;
980  return wait_thread_handle( info );
981 }
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
static struct _test_info info[]
Definition: SetCursorPos.c:19
#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:791
MSIFILE * msi_get_loaded_file(MSIPACKAGE *package, const WCHAR *key)
Definition: action.c:574
#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:411
const WCHAR * action
Definition: action.c:7479
GLenum target
Definition: glext.h:7315
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
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 983 of file custom.c.

985 {
986  MSIFILE *file;
987  HANDLE handle;
988  WCHAR *arg;
989 
990  if (!(file = msi_get_loaded_file( package, source ))) return ERROR_FUNCTION_FAILED;
991 
992  deformat_string( package, target, &arg );
993  TRACE("exe %s arg %s\n", debugstr_w(file->TargetPath), debugstr_w(arg));
994 
995  handle = execute_command( file->TargetPath, arg, L"C:\\" );
996  msi_free( arg );
998  return wait_process_handle( package, type, handle, action );
999 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
void * arg
Definition: msvc.h:10
static void msi_free(void *mem)
Definition: msipriv.h:1159
#define L(x)
Definition: ntvdm.h:50
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#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:354
MSIFILE * msi_get_loaded_file(MSIPACKAGE *package, const WCHAR *key)
Definition: action.c:574
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:877
const WCHAR * action
Definition: action.c:7479
GLenum target
Definition: glext.h:7315
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
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 1001 of file custom.c.

1003 {
1004  MSIRECORD *row = 0;
1005  LPWSTR deformated = NULL;
1006 
1007  deformat_string( package, target, &deformated );
1008 
1009  /* first try treat the error as a number */
1010  row = MSI_QueryGetRecord( package->db, L"SELECT `Message` FROM `Error` WHERE `Error` = '%s'", deformated );
1011  if( row )
1012  {
1014  if ((package->ui_level & INSTALLUILEVEL_MASK) != INSTALLUILEVEL_NONE)
1016  msiobj_release( &row->hdr );
1017  }
1018  else if ((package->ui_level & INSTALLUILEVEL_MASK) != INSTALLUILEVEL_NONE)
1019  MessageBoxW( NULL, deformated, NULL, MB_OK );
1020 
1021  msi_free( deformated );
1022 
1023  return ERROR_INSTALL_FAILURE;
1024 }
#define error(str)
Definition: mkdosfs.c:1605
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
static void msi_free(void *mem)
Definition: msipriv.h:1159
#define L(x)
Definition: ntvdm.h:50
const WCHAR * MSI_RecordGetString(const MSIRECORD *, UINT) DECLSPEC_HIDDEN
Definition: record.c:433
MSIRECORD *WINAPIV MSI_QueryGetRecord(MSIDATABASE *db, LPCWSTR query,...) DECLSPEC_HIDDEN
Definition: msiquery.c:201
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)
INSTALLUILEVEL ui_level
Definition: msipriv.h:452
#define ERROR_INSTALL_FAILURE
Definition: winerror.h:961
MSIDATABASE * db
Definition: msipriv.h:394
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:241
#define INSTALLUILEVEL_MASK
Definition: msipriv.h:60
#define NULL
Definition: types.h:112
#define MB_OK
Definition: winuser.h:784
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 944 of file custom.c.

946 {
947  MSIBINARY *binary;
948  HANDLE handle;
949  WCHAR *arg;
950 
951  if (!(binary = get_temp_binary(package, source)))
952  return ERROR_FUNCTION_FAILED;
953 
954  deformat_string( package, target, &arg );
955  TRACE("exe %s arg %s\n", debugstr_w(binary->tmpfile), debugstr_w(arg));
956 
957  handle = execute_command( binary->tmpfile, arg, L"C:\\" );
958  msi_free( arg );
960  return wait_process_handle( package, type, handle, action );
961 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
void * arg
Definition: msvc.h:10
static void msi_free(void *mem)
Definition: msipriv.h:1159
#define L(x)
Definition: ntvdm.h:50
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#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:354
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:877
const WCHAR * action
Definition: action.c:7479
GLenum target
Definition: glext.h:7315
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static MSIBINARY * get_temp_binary(MSIPACKAGE *package, LPCWSTR source)
Definition: custom.c:292

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 1330 of file custom.c.

1332 {
1334  MSIFILE *file;
1335  HANDLE hFile;
1336  DWORD sz, szHighWord = 0, read;
1337  CHAR *buffer=NULL;
1338  WCHAR *bufferw=NULL;
1339  BOOL bRet;
1340  UINT r;
1341 
1342  TRACE("%s %s\n", debugstr_w(source), debugstr_w(target));
1343 
1344  file = msi_get_loaded_file(package, source);
1345  if (!file)
1346  {
1347  ERR("invalid file key %s\n", debugstr_w(source));
1348  return ERROR_FUNCTION_FAILED;
1349  }
1350 
1351  hFile = msi_create_file( package, file->TargetPath, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, 0 );
1353 
1354  sz = GetFileSize(hFile, &szHighWord);
1355  if (sz == INVALID_FILE_SIZE || szHighWord != 0)
1356  {
1357  CloseHandle(hFile);
1358  return ERROR_FUNCTION_FAILED;
1359  }
1360  buffer = msi_alloc( sz + 1 );
1361  if (!buffer)
1362  {
1363  CloseHandle(hFile);
1364  return ERROR_FUNCTION_FAILED;
1365  }
1366  bRet = ReadFile(hFile, buffer, sz, &read, NULL);
1367  CloseHandle(hFile);
1368  if (!bRet)
1369  {
1371  goto done;
1372  }
1373  buffer[read] = 0;
1374  bufferw = strdupAtoW(buffer);
1375  if (!bufferw)
1376  {
1378  goto done;
1379  }
1380  info = do_msidbCustomActionTypeScript( package, type, bufferw, target, action );
1381  r = wait_thread_handle( info );
1382 
1383 done:
1384  msi_free(bufferw);
1385  msi_free(buffer);
1386  return r;
1387 }
#define CloseHandle
Definition: compat.h:598
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
char CHAR
Definition: xmlstorage.h:175
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
GLuint buffer
Definition: glext.h:5915
static void msi_free(void *mem)
Definition: msipriv.h:1159
#define INVALID_FILE_SIZE
Definition: winbase.h:545
#define FILE_SHARE_READ
Definition: compat.h:136
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
unsigned int BOOL
Definition: ntddk_ex.h:94
static struct _test_info info[]
Definition: SetCursorPos.c:19
#define debugstr_w
Definition: kernel32.h:32
#define OPEN_EXISTING
Definition: compat.h:634
MSIFILE * msi_get_loaded_file(MSIPACKAGE *package, const WCHAR *key)
Definition: action.c:574
HANDLE msi_create_file(MSIPACKAGE *package, const WCHAR *filename, DWORD access, DWORD sharing, DWORD creation, DWORD flags)
Definition: files.c:51
#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:331
#define GENERIC_READ
Definition: compat.h:135
_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:411
const WCHAR * action
Definition: action.c:7479
#define ReadFile(a, b, c, d, e)
Definition: compat.h:601
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1142
GLenum target
Definition: glext.h:7315
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
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:1240
_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 1043 of file custom.c.

1045 {
1046  WCHAR *dir, *filename, *args, *p;
1047  UINT len_dir, len_source = lstrlenW( source );
1048  HANDLE handle;
1049 
1050  if (!(dir = msi_dup_property( package->db, L"OriginalDatabase" ))) return ERROR_OUTOFMEMORY;
1051  if (!(p = wcsrchr( dir, '\\' )) && !(p = wcsrchr( dir, '/' )))
1052  {
1053  msi_free( dir );
1054  return ERROR_FUNCTION_FAILED;
1055  }
1056  *p = 0;
1057  len_dir = p - dir;
1058  if (!(filename = msi_alloc( (len_dir + len_source + 2) * sizeof(WCHAR) )))
1059  {
1060  msi_free( dir );
1061  return ERROR_OUTOFMEMORY;
1062  }
1063  memcpy( filename, dir, len_dir * sizeof(WCHAR) );
1064  filename[len_dir++] = '\\';
1065  memcpy( filename + len_dir, source, len_source * sizeof(WCHAR) );
1066  filename[len_dir + len_source] = 0;
1067 
1068  if (!(args = build_msiexec_args( filename, target )))
1069  {
1070  msi_free( dir );
1071  return ERROR_OUTOFMEMORY;
1072  }
1073 
1074  TRACE("installing %s concurrently\n", debugstr_w(source));
1075 
1076  handle = execute_command( L"msiexec", args, dir );
1077  msi_free( dir );
1078  msi_free( args );
1079  if (handle == INVALID_HANDLE_VALUE) return ERROR_SUCCESS;
1080  return wait_process_handle( package, type, handle, action );
1081 }
#define args
Definition: format.c:66
#define ERROR_SUCCESS
Definition: deptool.c:10
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
static void msi_free(void *mem)
Definition: msipriv.h:1159
const char * filename
Definition: ioapi.h:135
#define lstrlenW
Definition: compat.h:609
Definition: match.c:390
#define L(x)
Definition: ntvdm.h:50
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#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:354
static WCHAR * build_msiexec_args(const WCHAR *filename, const WCHAR *params)
Definition: custom.c:1026
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:394
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define wcsrchr
Definition: compat.h:16
static HANDLE execute_command(const WCHAR *app, WCHAR *arg, const WCHAR *dir)
Definition: custom.c:877
const WCHAR * action
Definition: action.c:7479
unsigned int UINT
Definition: ndis.h:50
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1142
GLenum target
Definition: glext.h:7315
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
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:2227

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 1174 of file custom.c.

1176 {
1177  const WCHAR *workingdir = NULL;
1178  HANDLE handle;
1179  WCHAR *cmd;
1180 
1181  if (source)
1182  {
1183  workingdir = msi_get_target_folder( package, source );
1184  if (!workingdir) return ERROR_FUNCTION_FAILED;
1185  }
1186  deformat_string( package, target, &cmd );
1187  if (!cmd) return ERROR_FUNCTION_FAILED;
1188 
1189  TRACE("cmd %s dir %s\n", debugstr_w(cmd), debugstr_w(workingdir));
1190 
1191  handle = execute_command( NULL, cmd, workingdir );
1192  msi_free( cmd );
1193  if (handle == INVALID_HANDLE_VALUE) return ERROR_SUCCESS;
1194  return wait_process_handle( package, type, handle, action );
1195 }
#define ERROR_SUCCESS
Definition: deptool.c:10
Definition: ftp_var.h:139
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
char * cmd
Definition: vfdcmd.c:85
static void msi_free(void *mem)
Definition: msipriv.h:1159
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#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:354
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:232
static HANDLE execute_command(const WCHAR *app, WCHAR *arg, const WCHAR *dir)
Definition: custom.c:877
const WCHAR * action
Definition: action.c:7479
#define NULL
Definition: types.h:112
GLenum target
Definition: glext.h:7315
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545

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 1271 of file custom.c.

1273 {
1275 
1276  TRACE("%s %s\n", debugstr_w(source), debugstr_w(target));
1277 
1279  return wait_thread_handle( info );
1280 }
static struct _test_info info[]
Definition: SetCursorPos.c:19
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
static UINT wait_thread_handle(msi_custom_action_info *info)
Definition: custom.c:411
const WCHAR * action
Definition: action.c:7479
#define NULL
Definition: types.h:112
GLenum target
Definition: glext.h:7315
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static msi_custom_action_info * do_msidbCustomActionTypeScript(MSIPACKAGE *package, INT type, LPCWSTR script, LPCWSTR function, LPCWSTR action)
Definition: custom.c:1240

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 1156 of file custom.c.

1158 {
1159  WCHAR *exe, *arg;
1160  HANDLE handle;
1161 
1162  if (!(exe = msi_dup_property( package->db, source ))) return ERROR_SUCCESS;
1163 
1164  deformat_string( package, target, &arg );
1165  TRACE("exe %s arg %s\n", debugstr_w(exe), debugstr_w(arg));
1166 
1167  handle = execute_command( exe, arg, L"C:\\" );
1168  msi_free( exe );
1169  msi_free( arg );
1170  if (handle == INVALID_HANDLE_VALUE) return ERROR_SUCCESS;
1171  return wait_process_handle( package, type, handle, action );
1172 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
void * arg
Definition: msvc.h:10
static void msi_free(void *mem)
Definition: msipriv.h:1159
#define L(x)
Definition: ntvdm.h:50
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define debugstr_w
Definition: kernel32.h:32
static UINT wait_process_handle(MSIPACKAGE *package, UINT type, HANDLE ProcessHandle, LPCWSTR name)
Definition: custom.c:354
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:394
static HANDLE execute_command(const WCHAR *app, WCHAR *arg, const WCHAR *dir)
Definition: custom.c:877
const WCHAR * action
Definition: action.c:7479
GLenum target
Definition: glext.h:7315
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
LPWSTR msi_dup_property(MSIDATABASE *db, LPCWSTR prop) DECLSPEC_HIDDEN
Definition: package.c:2227

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 1389 of file custom.c.

1391 {
1393  WCHAR *prop;
1394 
1395  TRACE("%s %s\n", debugstr_w(source), debugstr_w(target));
1396 
1397  prop = msi_dup_property( package->db, source );
1398  if (!prop) return ERROR_SUCCESS;
1399 
1400  info = do_msidbCustomActionTypeScript( package, type, prop, NULL, action );
1401  msi_free(prop);
1402  return wait_thread_handle( info );
1403 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static void msi_free(void *mem)
Definition: msipriv.h:1159
static struct _test_info info[]
Definition: SetCursorPos.c:19
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
MSIDATABASE * db
Definition: msipriv.h:394
static UINT wait_thread_handle(msi_custom_action_info *info)
Definition: custom.c:411
const WCHAR * action
Definition: action.c:7479
#define NULL
Definition: types.h:112
GLenum target
Definition: glext.h:7315
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static msi_custom_action_info * do_msidbCustomActionTypeScript(MSIPACKAGE *package, INT type, LPCWSTR script, LPCWSTR function, LPCWSTR action)
Definition: custom.c:1240
LPWSTR msi_dup_property(MSIDATABASE *db, LPCWSTR prop) DECLSPEC_HIDDEN
Definition: package.c:2227

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 1282 of file custom.c.

1284 {
1285  MSIRECORD *row = NULL;
1287  CHAR *buffer = NULL;
1288  WCHAR *bufferw = NULL;
1289  DWORD sz = 0;
1290  UINT r;
1291 
1292  TRACE("%s %s\n", debugstr_w(source), debugstr_w(target));
1293 
1294  row = MSI_QueryGetRecord(package->db, L"SELECT * FROM `Binary` WHERE `Name` = '%s'", source);
1295  if (!row)
1296  return ERROR_FUNCTION_FAILED;
1297 
1298  r = MSI_RecordReadStream(row, 2, NULL, &sz);
1299  if (r != ERROR_SUCCESS) goto done;
1300 
1301  buffer = msi_alloc( sz + 1 );
1302  if (!buffer)
1303  {
1305  goto done;
1306  }
1307 
1308  r = MSI_RecordReadStream(row, 2, buffer, &sz);
1309  if (r != ERROR_SUCCESS)
1310  goto done;
1311 
1312  buffer[sz] = 0;
1313  bufferw = strdupAtoW(buffer);
1314  if (!bufferw)
1315  {
1317  goto done;
1318  }
1319 
1320  info = do_msidbCustomActionTypeScript( package, type, bufferw, target, action );
1321  r = wait_thread_handle( info );
1322 
1323 done:
1324  msi_free(bufferw);
1325  msi_free(buffer);
1326  msiobj_release(&row->hdr);
1327  return r;
1328 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
char CHAR
Definition: xmlstorage.h:175
GLuint buffer
Definition: glext.h:5915
static void msi_free(void *mem)
Definition: msipriv.h:1159
#define L(x)
Definition: ntvdm.h:50
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
static struct _test_info info[]
Definition: SetCursorPos.c:19
#define debugstr_w
Definition: kernel32.h:32
MSIRECORD *WINAPIV MSI_QueryGetRecord(MSIDATABASE *db, LPCWSTR query,...) DECLSPEC_HIDDEN
Definition: msiquery.c:201
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
MSIDATABASE * db
Definition: msipriv.h:394
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:241
static UINT wait_thread_handle(msi_custom_action_info *info)
Definition: custom.c:411
const WCHAR * action
Definition: action.c:7479
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
UINT MSI_RecordReadStream(MSIRECORD *, UINT, char *, LPDWORD) DECLSPEC_HIDDEN
Definition: record.c:761
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1142
GLenum target
Definition: glext.h:7315
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
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:1240
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_CustomType7()

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

Definition at line 1122 of file custom.c.

1124 {
1125  WCHAR *tmpfile, *args;
1126  MSIBINARY *binary = NULL;
1127  HANDLE handle;
1128  UINT r;
1129 
1130  if (!(tmpfile = msi_create_temp_file( package->db ))) return ERROR_FUNCTION_FAILED;
1131 
1132  r = write_substorage_to_file( package, source, tmpfile );
1133  if (r != ERROR_SUCCESS)
1134  goto error;
1135 
1136  if (!(binary = msi_alloc( sizeof(*binary) ))) goto error;
1137  binary->source = NULL;
1138  binary->tmpfile = tmpfile;
1139  list_add_tail( &package->binaries, &binary->entry );
1140 
1142 
1143  TRACE("installing %s concurrently\n", debugstr_w(source));
1144 
1145  handle = execute_command( L"msiexec", args, L"C:\\" );
1146  msi_free( args );
1147  if (handle == INVALID_HANDLE_VALUE) return ERROR_SUCCESS;
1148  return wait_process_handle( package, type, handle, action );
1149 
1150 error:
1151  DeleteFileW( tmpfile );
1152  msi_free( tmpfile );
1153  return ERROR_FUNCTION_FAILED;
1154 }
#define args
Definition: format.c:66
#define ERROR_SUCCESS
Definition: deptool.c:10
#define error(str)
Definition: mkdosfs.c:1605
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
static void msi_free(void *mem)
Definition: msipriv.h:1159
Definition: match.c:390
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
#define L(x)
Definition: ntvdm.h:50
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#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:354
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
struct list binaries
Definition: msipriv.h:407
static WCHAR * build_msiexec_args(const WCHAR *filename, const WCHAR *params)
Definition: custom.c:1026
static UINT write_substorage_to_file(MSIPACKAGE *package, const WCHAR *source, const WCHAR *filename)
Definition: custom.c:1083
_Check_return_ _CRTIMP FILE *__cdecl tmpfile(void)
Definition: file.c:3912
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
MSIDATABASE * db
Definition: msipriv.h:394
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:877
const WCHAR * action
Definition: action.c:7479
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
WCHAR * msi_create_temp_file(MSIDATABASE *db)
Definition: custom.c:215
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1142
GLenum target
Definition: glext.h:7315
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by ACTION_CustomAction().

◆ handle_msi_break()

static void handle_msi_break ( const WCHAR action)
static

Definition at line 458 of file custom.c.

459 {
460  const WCHAR fmt[] = L"To debug your custom action, attach your debugger to process %u (0x%x) and press OK";
461  WCHAR val[MAX_PATH], msg[100];
462 
463  if (!GetEnvironmentVariableW( L"MsiBreak", val, MAX_PATH ) || wcscmp( val, action )) return;
464 
466  MessageBoxW( NULL, msg, L"Windows Installer", MB_OK );
467  DebugBreak();
468 }
#define L(x)
Definition: ntvdm.h:50
void WINAPI DebugBreak(void)
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:34
int _cdecl swprintf(const WCHAR *,...)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
const WCHAR * action
Definition: action.c:7479
#define ARRAY_SIZE(a)
Definition: main.h:24
#define NULL
Definition: types.h:112
#define MB_OK
Definition: winuser.h:784
#define msg(x)
Definition: auth_time.c:54
#define GetEnvironmentVariableW(x, y, z)
Definition: compat.h:614
Definition: dsound.c:943
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1158

Referenced by __wine_msi_call_dll_function().

◆ MIDL_user_allocate()

void __RPC_FAR* __RPC_USER MIDL_user_allocate ( SIZE_T  len)

Definition at line 75 of file custom.c.

76 {
77  return malloc(len);
78 }
GLenum GLsizei len
Definition: glext.h:6722
#define malloc
Definition: debug_ros.c:4

◆ MIDL_user_free()

void __RPC_USER MIDL_user_free ( void __RPC_FAR ptr)

Definition at line 80 of file custom.c.

81 {
82  free(ptr);
83 }
#define free
Definition: debug_ros.c:5
static PVOID ptr
Definition: dispmode.c:27

◆ msi_action_is_unique()

BOOL msi_action_is_unique ( const MSIPACKAGE package,
const WCHAR action 
)

Definition at line 131 of file custom.c.

132 {
133  UINT i;
134 
135  for (i = 0; i < package->unique_actions_count; i++)
136  {
137  if (!wcscmp( package->unique_actions[i], action )) return TRUE;
138  }
139  return FALSE;
140 }
#define TRUE
Definition: types.h:120
LPWSTR * unique_actions
Definition: msipriv.h:435
#define FALSE
Definition: types.h:117
int unique_actions_count
Definition: msipriv.h:436
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
const WCHAR * action
Definition: action.c:7479
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
unsigned int UINT
Definition: ndis.h:50

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 215 of file custom.c.

216 {
217  WCHAR *ret;
218 
219  if (!db->tempfolder)
220  {
221  WCHAR tmp[MAX_PATH];
222  DWORD len = ARRAY_SIZE( tmp );
223 
224  if (msi_get_property( db, L"TempFolder", tmp, &len ) ||
226  {
227  GetTempPathW( MAX_PATH, tmp );
228  }
229  if (!(db->tempfolder = strdupW( tmp ))) return NULL;
230  }
231 
232  if ((ret = msi_alloc( (lstrlenW( db->tempfolder ) + 20) * sizeof(WCHAR) )))
233  {
234  if (!GetTempFileNameW( db->tempfolder, L"msi", 0, ret ))
235  {
236  msi_free( ret );
237  return NULL;
238  }
239  }
240 
241  return ret;
242 }
LPWSTR tempfolder
Definition: msipriv.h:114
UINT msi_get_property(MSIDATABASE *, LPCWSTR, LPWSTR, LPDWORD) DECLSPEC_HIDDEN
Definition: package.c:2194
static WCHAR * strdupW(const WCHAR *src)
Definition: main.c:92
static void msi_free(void *mem)
Definition: msipriv.h:1159
#define lstrlenW
Definition: compat.h:609
#define L(x)
Definition: ntvdm.h:50
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2080
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName)
Definition: filename.c:84
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define ARRAY_SIZE(a)
Definition: main.h:24
#define NULL
Definition: types.h:112
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1142

Referenced by create_temp_binary(), HANDLE_CustomType7(), 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 181 of file custom.c.

183 {
184  LPWSTR deferred;
185  DWORD len;
186 
187  if (!actiondata)
188  return strdupW(action);
189 
190  len = lstrlenW(action) + lstrlenW(actiondata) +
191  lstrlenW(usersid) + lstrlenW(prodcode) +
192  lstrlenW(L"[%s<=>%s<=>%s]%s") - 7;
193  deferred = msi_alloc(len * sizeof(WCHAR));
194 
195  swprintf(deferred, len, L"[%s<=>%s<=>%s]%s", actiondata, usersid, prodcode, action);
196  return deferred;
197 }
static WCHAR * strdupW(const WCHAR *src)
Definition: main.c:92
#define lstrlenW
Definition: compat.h:609
#define L(x)
Definition: ntvdm.h:50
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
int _cdecl swprintf(const WCHAR *,...)
const WCHAR * action
Definition: action.c:7479
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1142
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 113 of file custom.c.

114 {
115  UINT count;
116  WCHAR **newbuf = NULL;
117 
118  TRACE("Registering %s as unique action\n", debugstr_w(action));
119 
120  count = package->unique_actions_count;
121  package->unique_actions_count++;
122  if (count != 0) newbuf = msi_realloc( package->unique_actions,
123  package->unique_actions_count * sizeof(WCHAR *) );
124  else newbuf = msi_alloc( sizeof(WCHAR *) );
125 
126  newbuf[count] = strdupW( action );
127  package->unique_actions = newbuf;
128  return ERROR_SUCCESS;
129 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static WCHAR * strdupW(const WCHAR *src)
Definition: main.c:92
LPWSTR * unique_actions
Definition: msipriv.h:435
GLuint GLuint GLsizei count
Definition: gl.h:1545
static void * msi_realloc(void *mem, size_t len) __WINE_ALLOC_SIZE(2)
Definition: msipriv.h:1154
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
int unique_actions_count
Definition: msipriv.h:436
const WCHAR * action
Definition: action.c:7479
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1142

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 90 of file custom.c.

91 {
92  UINT count;
93  WCHAR **newbuf = NULL;
94 
95  if (script >= SCRIPT_MAX)
96  {
97  FIXME("Unknown script requested %u\n", script);
98  return ERROR_FUNCTION_FAILED;
99  }
100  TRACE("Scheduling action %s in script %u\n", debugstr_w(action), script);
101 
102  count = package->script_actions_count[script];
103  package->script_actions_count[script]++;
104  if (count != 0) newbuf = msi_realloc( package->script_actions[script],
105  package->script_actions_count[script] * sizeof(WCHAR *) );
106  else newbuf = msi_alloc( sizeof(WCHAR *) );
107 
108  newbuf[count] = strdupW( action );
109  package->script_actions[script] = 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
static void * msi_realloc(void *mem, size_t len) __WINE_ALLOC_SIZE(2)
Definition: msipriv.h:1154
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
script
Definition: msipriv.h:382
#define TRACE(s)
Definition: solgame.cpp:4
LPWSTR * script_actions[SCRIPT_MAX]
Definition: msipriv.h:433
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * action
Definition: action.c:7479
int script_actions_count[SCRIPT_MAX]
Definition: msipriv.h:434
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1142

Referenced by ACTION_CreateFolders(), ACTION_CreateShortcuts(), ACTION_DeleteServices(), ACTION_DuplicateFiles(), ACTION_HandleStandardAction(), ACTION_InstallFiles(), ACTION_InstallODBC(), ACTION_InstallServices(), ACTION_MoveFiles(), ACTION_MsiPublishAssemblies(), ACTION_MsiUnpublishAssemblies(), ACTION_PatchFiles(), ACTION_ProcessComponents(), ACTION_PublishComponents(), ACTION_PublishFeatures(), ACTION_PublishProduct(), ACTION_RegisterClassInfo(), ACTION_RegisterExtensionInfo(), ACTION_RegisterFonts(), ACTION_RegisterMIMEInfo(), ACTION_RegisterProduct(), ACTION_RegisterProgIdInfo(), ACTION_RegisterTypeLibraries(), ACTION_RegisterUser(), ACTION_RemoveDuplicateFiles(), ACTION_RemoveEnvironmentStrings(), ACTION_RemoveFiles(), ACTION_RemoveFolders(), ACTION_RemoveIniValues(), ACTION_RemoveODBC(), ACTION_RemoveRegistryValues(), ACTION_RemoveShortcuts(), ACTION_SelfRegModules(), ACTION_SelfUnregModules(), ACTION_StartServices(), ACTION_StopServices(), ACTION_UnpublishComponents(), ACTION_UnpublishFeatures(), ACTION_UnregisterClassInfo(), ACTION_UnregisterExtensionInfo(), ACTION_UnregisterFonts(), ACTION_UnregisterMIMEInfo(), ACTION_UnregisterProgIdInfo(), ACTION_UnregisterTypeLibraries(), ACTION_WriteEnvironmentStrings(), ACTION_WriteIniValues(), ACTION_WriteRegistryValues(), and defer_custom_action().

◆ rpc_filter()

◆ s_remote_GetActionInfo()

UINT __cdecl s_remote_GetActionInfo ( const GUID guid,
WCHAR **  name,
int type,
WCHAR **  dll,
char **  func,
MSIHANDLE hinst 
)

Definition at line 1658 of file custom.c.

1659 {
1661 
1663  if (!info)
1664  return ERROR_INVALID_DATA;
1665 
1666  *name = strdupW(info->action);
1667  *type = info->type;
1668  *hinst = alloc_msihandle(&info->package->hdr);
1669  *dll = strdupW(info->source);
1670  *func = strdupWtoA(info->target);
1671 
1672  return ERROR_SUCCESS;
1673 }
GLenum func
Definition: glext.h:6028
#define ERROR_SUCCESS
Definition: deptool.c:10
static WCHAR * strdupW(const WCHAR *src)
Definition: main.c:92
static LPSTR strdupWtoA(LPCWSTR str)
Definition: hhctrl.h:299
static HMODULE dll
Definition: str.c:188
const GUID * guid
static struct _test_info info[]
Definition: SetCursorPos.c:19
#define ERROR_INVALID_DATA
Definition: winerror.h:116
MSIHANDLE alloc_msihandle(MSIOBJECTHDR *obj)
Definition: handle.c:111
static msi_custom_action_info * find_action_by_guid(const GUID *guid)
Definition: custom.c:434
Definition: name.c:38
static HINSTANCE hinst
Definition: edit.c:551
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545

◆ ScriptThread()

static DWORD WINAPI ScriptThread ( LPVOID  arg)
static

Definition at line 1225 of file custom.c.

1226 {
1227  LPGUID guid = arg;
1228  DWORD rc;
1229 
1230  TRACE("custom action (%#lx) started\n", GetCurrentThreadId() );
1231 
1232  rc = ACTION_CallScript( guid );
1233 
1234  TRACE("custom action (%#lx) returned %lu\n", GetCurrentThreadId(), rc );
1235 
1237  return rc;
1238 }
UINT WINAPI MsiCloseAllHandles(void)
Definition: handle.c:325
void * arg
Definition: msvc.h:10
const GUID * guid
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:459
#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:1197

Referenced by do_msidbCustomActionTypeScript().

◆ set_deferred_action_props()

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

Definition at line 199 of file custom.c.

200 {
201  const WCHAR *end, *beg = deferred_data + 1;
202 
203  end = wcsstr(beg, L"<=>");
204  msi_set_property( package->db, L"CustomActionData", beg, end - beg );
205  beg = end + 3;
206 
207  end = wcsstr(beg, L"<=>");
208  msi_set_property( package->db, L"UserSID", beg, end - beg );
209  beg = end + 3;
210 
211  end = wcschr(beg, ']');
212  msi_set_property( package->db, L"ProductCode", beg, end - beg );
213 }
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
#define L(x)
Definition: ntvdm.h:50
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
__wchar_t WCHAR
Definition: xmlstorage.h:180
MSIDATABASE * db
Definition: msipriv.h:394
GLuint GLuint end
Definition: gl.h:1545
UINT msi_set_property(MSIDATABASE *, const WCHAR *, const WCHAR *, int) DECLSPEC_HIDDEN
Definition: package.c:2044

Referenced by ACTION_CustomAction().

◆ wait_process_handle()

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

Definition at line 354 of file custom.c.

356 {
357  UINT rc = ERROR_SUCCESS;
358 
360  {
361  TRACE("waiting for %s\n", debugstr_w(name));
362 
364 
367 
369  }
370  else
371  {
372  TRACE("%s running in background\n", debugstr_w(name));
373 
376  else
378  }
379 
380  return rc;
381 }
static UINT custom_get_process_return(HANDLE process)
Definition: custom.c:319
#define CloseHandle
Definition: compat.h:598
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
#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:305
unsigned int UINT
Definition: ndis.h:50
Definition: name.c:38
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
_In_ HANDLE ProcessHandle
Definition: mmfuncs.h:403
void msi_dialog_check_messages(HANDLE handle)
Definition: dialog.c:4052

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

◆ wait_thread_handle()

static UINT wait_thread_handle ( msi_custom_action_info info)
static

Definition at line 411 of file custom.c.

412 {
413  UINT rc = ERROR_SUCCESS;
414 
415  if (!(info->type & msidbCustomActionTypeAsync))
416  {
417  TRACE("waiting for %s\n", debugstr_w( info->action ));
418 
419  msi_dialog_check_messages( info->handle );
420 
421  if (!(info->type & msidbCustomActionTypeContinue))
422  rc = custom_get_thread_return( info->package, info->handle );
423 
425  }
426  else
427  {
428  TRACE("%s running in background\n", debugstr_w( info->action ));
429  }
430 
431  return rc;
432 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define debugstr_w
Definition: kernel32.h:32
static void free_custom_action_data(msi_custom_action_info *info)
Definition: custom.c:395
#define TRACE(s)
Definition: solgame.cpp:4
static UINT custom_get_thread_return(MSIPACKAGE *package, HANDLE thread)
Definition: custom.c:330
unsigned int UINT
Definition: ndis.h:50
void msi_dialog_check_messages(HANDLE handle)
Definition: dialog.c:4052

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  )

◆ write_substorage_to_file()

static UINT write_substorage_to_file ( MSIPACKAGE package,
const WCHAR source,
const WCHAR filename 
)
static

Definition at line 1083 of file custom.c.

1084 {
1085  IStorage *src = NULL, *dst = NULL;
1087  HRESULT hr;
1088 
1090  if (FAILED( hr ))
1091  {
1092  WARN( "can't open destination storage %s (%#lx)\n", debugstr_w(filename), hr );
1093  goto done;
1094  }
1095 
1096  hr = IStorage_OpenStorage( package->db->storage, source, NULL, STGM_SHARE_EXCLUSIVE, NULL, 0, &src );
1097  if (FAILED( hr ))
1098  {
1099  WARN( "can't open source storage %s (%#lx)\n", debugstr_w(source), hr );
1100  goto done;
1101  }
1102 
1103  hr = IStorage_CopyTo( src, 0, NULL, NULL, dst );
1104  if (FAILED( hr ))
1105  {
1106  ERR( "failed to copy storage %s (%#lx)\n", debugstr_w(source), hr );
1107  goto done;
1108  }
1109 
1110  hr = IStorage_Commit( dst, 0 );
1111  if (FAILED( hr ))
1112  ERR( "failed to commit storage (%#lx)\n", hr );
1113  else
1114  r = ERROR_SUCCESS;
1115 
1116 done:
1117  if (src) IStorage_Release( src );
1118  if (dst) IStorage_Release( dst );
1119  return r;
1120 }
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:922
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define WARN(fmt,...)
Definition: debug.h:112
#define STGM_CREATE
Definition: objbase.h:925
const char * filename
Definition: ioapi.h:135
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define debugstr_w
Definition: kernel32.h:32
#define STGM_WRITE
Definition: objbase.h:917
LONG HRESULT
Definition: typedefs.h:79
MSIDATABASE * db
Definition: msipriv.h:394
HRESULT WINAPI StgCreateDocfile(LPCOLESTR pwcsName, DWORD grfMode, DWORD reserved, IStorage **ppstgOpen)
Definition: storage32.c:8636
GLenum src
Definition: glext.h:6340
#define ERR(fmt,...)
Definition: debug.h:110
GLenum GLenum dst
Definition: glext.h:6340
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define STGM_TRANSACTED
Definition: objbase.h:914
IStorage * storage
Definition: msipriv.h:109

Referenced by HANDLE_CustomType7().

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:63
LIST_ENTRY ProcessLocksList
Definition: winbase.h:880
static CRITICAL_SECTION_DEBUG msi_custom_action_cs_debug
Definition: custom.c:64

Definition at line 64 of file custom.c.

◆ msi_pending_custom_actions

struct list msi_pending_custom_actions = LIST_INIT( msi_pending_custom_actions )
static