ReactOS  0.4.15-dev-5137-g826bd41
package.c File Reference
#include <assert.h>
#include <stdio.h>
#include <windows.h>
#include <msidefs.h>
#include <msi.h>
#include <msiquery.h>
#include <srrestoreptapi.h>
#include <shlobj.h>
#include <sddl.h>
#include "wine/test.h"
Include dependency graph for package.c:

Go to the source code of this file.

Classes

struct  _tagVS_VERSIONINFO
 
struct  access_res
 
struct  externalui_message
 

Macros

#define COBJMACROS
 
#define GET_PROC(mod, func)   p ## func = (void*)GetProcAddress(mod, #func);
 
#define add_component_entry(hdb, values)
 
#define add_directory_entry(hdb, values)
 
#define add_feature_entry(hdb, values)
 
#define add_feature_components_entry(hdb, values)
 
#define add_file_entry(hdb, values)
 
#define add_appsearch_entry(hdb, values)
 
#define add_signature_entry(hdb, values)
 
#define add_launchcondition_entry(hdb, values)
 
#define add_property_entry(hdb, values)
 
#define update_ProductVersion_property(hdb, value)
 
#define update_ProductCode_property(hdb, value)
 
#define add_install_execute_sequence_entry(hdb, values)
 
#define add_install_ui_sequence_entry(hdb, values)
 
#define add_media_entry(hdb, values)
 
#define add_ccpsearch_entry(hdb, values)
 
#define add_drlocator_entry(hdb, values)
 
#define add_complocator_entry(hdb, values)
 
#define add_inilocator_entry(hdb, values)
 
#define add_custom_action_entry(hdb, values)
 
#define add_dialog_entry(hdb, values)
 
#define add_control_entry(hdb, values)
 
#define add_controlevent_entry(hdb, values)
 
#define add_actiontext_entry(hdb, values)
 
#define add_upgrade_entry(hdb, values)
 
#define roundoffs(a, b, r)   (((BYTE *)(b) - (BYTE *)(a) + ((r) - 1)) & ~((r) - 1))
 
#define roundpos(a, b, r)   (((BYTE *)(a)) + roundoffs(a, b, r))
 
#define test_file_access(file, ares)   _test_file_access(file, ares, __LINE__)
 
#define ok_sequence(exp, contx, todo)   ok_sequence_((exp), (contx), (todo), __FILE__, __LINE__)
 

Typedefs

typedef struct _tagVS_VERSIONINFO VS_VERSIONINFO
 

Functions

static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)(LPCSTR
 
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY
 
static BOOL (WINAPI *pIsWow64Process)(HANDLE
 
static STATEMGRSTATUS *static void init_functionpointers (void)
 
static BOOL is_process_limited (void)
 
static LONG delete_key (HKEY key, LPCSTR subkey, REGSAM access)
 
static charget_user_sid (void)
 
static LSTATUS package_RegDeleteTreeW (HKEY hKey, LPCWSTR lpszSubKey, REGSAM access)
 
static BOOL squash_guid (LPCWSTR in, LPWSTR out)
 
static void create_test_guid (LPSTR prodcode, LPSTR squashed)
 
static void set_component_path (LPCSTR filename, MSIINSTALLCONTEXT context, LPCSTR guid, LPSTR usersid, BOOL dir)
 
static void delete_component_path (LPCSTR guid, MSIINSTALLCONTEXT context, LPSTR usersid)
 
static UINT do_query (MSIHANDLE hdb, const char *query, MSIHANDLE *phrec)
 
static UINT run_query (MSIHANDLE hdb, const char *query)
 
static UINT create_component_table (MSIHANDLE hdb)
 
static UINT create_feature_table (MSIHANDLE hdb)
 
static UINT create_feature_components_table (MSIHANDLE hdb)
 
static UINT create_file_table (MSIHANDLE hdb)
 
static UINT create_remove_file_table (MSIHANDLE hdb)
 
static UINT create_appsearch_table (MSIHANDLE hdb)
 
static UINT create_reglocator_table (MSIHANDLE hdb)
 
static UINT create_signature_table (MSIHANDLE hdb)
 
static UINT create_launchcondition_table (MSIHANDLE hdb)
 
static UINT create_property_table (MSIHANDLE hdb)
 
static UINT create_install_execute_sequence_table (MSIHANDLE hdb)
 
static UINT create_install_ui_sequence_table (MSIHANDLE hdb)
 
static UINT create_media_table (MSIHANDLE hdb)
 
static UINT create_ccpsearch_table (MSIHANDLE hdb)
 
static UINT create_drlocator_table (MSIHANDLE hdb)
 
static UINT create_complocator_table (MSIHANDLE hdb)
 
static UINT create_inilocator_table (MSIHANDLE hdb)
 
static UINT create_custom_action_table (MSIHANDLE hdb)
 
static UINT create_dialog_table (MSIHANDLE hdb)
 
static UINT create_control_table (MSIHANDLE hdb)
 
static UINT create_controlevent_table (MSIHANDLE hdb)
 
static UINT create_actiontext_table (MSIHANDLE hdb)
 
static UINT create_upgrade_table (MSIHANDLE hdb)
 
static UINT add_entry (const char *file, int line, const char *type, MSIHANDLE hdb, const char *values, const char *insert)
 
static UINT add_reglocator_entry (MSIHANDLE hdb, const char *sig, UINT root, const char *path, const char *name, UINT type)
 
static UINT set_summary_info (MSIHANDLE hdb)
 
static MSIHANDLE create_package_db (void)
 
static UINT package_from_db (MSIHANDLE hdb, MSIHANDLE *handle)
 
static void create_file_data (LPCSTR name, LPCSTR data)
 
static void create_test_file (const CHAR *name)
 
static BOOL create_file_with_version (const CHAR *name, LONG ms, LONG ls)
 
static BOOL notify_system_change (DWORD event_type, STATEMGRSTATUS *status)
 
static void remove_restore_point (DWORD seq_number)
 
static BOOL is_root (const char *path)
 
static void test_createpackage (void)
 
static void test_doaction (void)
 
static void test_gettargetpath_bad (void)
 
static void query_file_path (MSIHANDLE hpkg, LPCSTR file, LPSTR buff)
 
static void test_settargetpath (void)
 
static void test_condition (void)
 
static void check_prop (MSIHANDLE hpkg, const char *prop, const char *expect, int match_case)
 
static void test_props (void)
 
static BOOL find_prop_in_property (MSIHANDLE hdb, LPCSTR prop, LPCSTR val, int len)
 
static void test_property_table (void)
 
static UINT try_query_param (MSIHANDLE hdb, LPCSTR szQuery, MSIHANDLE hrec)
 
static UINT try_query (MSIHANDLE hdb, LPCSTR szQuery)
 
static void set_summary_str (MSIHANDLE hdb, DWORD pid, LPCSTR value)
 
static void set_summary_dword (MSIHANDLE hdb, DWORD pid, DWORD value)
 
static void test_msipackage (void)
 
static void test_formatrecord2 (void)
 
static void test_formatrecord_tables (void)
 
static void test_feature_states (UINT line, MSIHANDLE package, const char *feature, UINT error, INSTALLSTATE expected_state, INSTALLSTATE expected_action, BOOL todo)
 
static void test_component_states (UINT line, MSIHANDLE package, const char *component, UINT error, INSTALLSTATE expected_state, INSTALLSTATE expected_action, BOOL todo)
 
static void test_states (void)
 
static void test_removefiles (void)
 
static void test_appsearch (void)
 
static void test_appsearch_complocator (void)
 
static void test_appsearch_reglocator (void)
 
static void delete_win_ini (LPCSTR file)
 
static void test_appsearch_inilocator (void)
 
static void search_absolute_directory (LPSTR absolute, LPCSTR relative)
 
static void test_appsearch_drlocator (void)
 
static void test_featureparents (void)
 
static void test_installprops (void)
 
static void test_launchconditions (void)
 
static void test_ccpsearch (void)
 
static void test_complocator (void)
 
static void set_suminfo_prop (MSIHANDLE db, DWORD prop, DWORD val)
 
static void test_MsiGetSourcePath (void)
 
static void test_shortlongsource (void)
 
static void test_sourcedir (void)
 
static void _test_file_access (LPCSTR file, const struct access_res *ares, DWORD line)
 
static void test_access (void)
 
static void test_emptypackage (void)
 
static void test_MsiGetProductProperty (void)
 
static void test_MsiSetProperty (void)
 
static void test_MsiApplyMultiplePatches (void)
 
static void test_MsiApplyPatch (void)
 
static void test_costs (void)
 
static void test_MsiDatabaseCommit (void)
 
static INT CALLBACK externalui_callback (void *context, UINT message_type, LPCSTR message)
 
static INT CALLBACK externalui_record_callback (void *context, UINT message_type, MSIHANDLE hrecord)
 
static void test_externalui (void)
 
static void add_message (const struct externalui_message *msg)
 
static void flush_sequence (void)
 
static void ok_sequence_ (const struct externalui_message *expected, const char *context, BOOL todo, const char *file, int line)
 
static INT CALLBACK externalui_message_string_callback (void *context, UINT message, LPCSTR string)
 
static INT CALLBACK externalui_message_callback (void *context, UINT message, MSIHANDLE hrecord)
 
static void test_externalui_message (void)
 
static void test_controlevent (void)
 
static void test_top_level_action (void)
 
 START_TEST (package)
 

Variables

static BOOL is_wow64
 
static const char msifile [] = "winetest-package.msi"
 
static const WCHAR msifileW [] = L"winetest-package.msi"
 
static char CURR_DIR [MAX_PATH]
 
static LPCSTR
 
static MSIINSTALLCONTEXT
 
static LPSTR
 
static LPDWORD
 
static REGSAM
 
static DWORD
 
static LPCWSTR
 
static PBOOL
 
static const struct access_res create [16]
 
static const struct access_res create_commit [16]
 
static const struct access_res create_close [16]
 
static int externalui_ran
 
static int externalui_record_ran
 
static struct externalui_messagesequence
 
static int sequence_count
 
static int sequence_size
 
static const INSTALLLOGMODE MSITEST_INSTALLLOGMODE
 
static const struct externalui_message empty_sequence []
 
static const struct externalui_message openpackage_nonexistent_sequence []
 
static const struct externalui_message openpackage_sequence []
 
static const struct externalui_message processmessage_info_sequence []
 
static const struct externalui_message processmessage_actionstart_sequence []
 
static const struct externalui_message processmessage_actiondata_sequence []
 
static const struct externalui_message processmessage_error_sequence []
 
static const struct externalui_message processmessage_internal_error_sequence []
 
static const struct externalui_message processmessage_error_format_sequence []
 
static const struct externalui_message doaction_costinitialize_sequence []
 
static const struct externalui_message doaction_custom_sequence []
 
static const struct externalui_message doaction_custom_fullui_sequence []
 
static const struct externalui_message doaction_custom_cancel_sequence []
 
static const struct externalui_message doaction_dialog_nonexistent_sequence []
 
static const struct externalui_message doaction_dialog_sequence []
 
static const struct externalui_message doaction_dialog_error_sequence []
 
static const struct externalui_message doaction_dialog_3_sequence []
 
static const struct externalui_message doaction_dialog_12345_sequence []
 
static const struct externalui_message closehandle_sequence []
 
static const struct externalui_message controlevent_spawn_sequence []
 
static const struct externalui_message controlevent_spawn2_sequence []
 
static const struct externalui_message toplevel_install_sequence []
 
static const struct externalui_message toplevel_install_ui_sequence []
 
static const struct externalui_message toplevel_executeaction_install_sequence []
 
static const struct externalui_message toplevel_executeaction_costinitialize_sequence []
 
static const struct externalui_message toplevel_msiinstallproduct_sequence []
 
static const struct externalui_message toplevel_msiinstallproduct_custom_sequence []
 

Macro Definition Documentation

◆ add_actiontext_entry

#define add_actiontext_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "ActionText", hdb, values, \
"INSERT INTO `ActionText` " \
"(`Action`, `Description`, `Template`) VALUES( %s )");
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
static UINT add_entry(const char *file, int line, const char *type, MSIHANDLE hdb, const char *values, const char *insert)
Definition: package.c:745

Definition at line 850 of file package.c.

◆ add_appsearch_entry

#define add_appsearch_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "AppSearch", hdb, values, \
"INSERT INTO `AppSearch` " \
"(`Property`, `Signature_`) VALUES( %s )")
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
static UINT add_entry(const char *file, int line, const char *type, MSIHANDLE hdb, const char *values, const char *insert)
Definition: package.c:745

Definition at line 782 of file package.c.

◆ add_ccpsearch_entry

#define add_ccpsearch_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "CCPSearch", hdb, values, \
"INSERT INTO `CCPSearch` (`Signature_`) VALUES( %s )")
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
static UINT add_entry(const char *file, int line, const char *type, MSIHANDLE hdb, const char *values, const char *insert)
Definition: package.c:745

Definition at line 818 of file package.c.

◆ add_complocator_entry

#define add_complocator_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "CompLocator", hdb, values, \
"INSERT INTO `CompLocator` " \
"(`Signature_`, `ComponentId`, `Type`) VALUES( %s )")
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
static UINT add_entry(const char *file, int line, const char *type, MSIHANDLE hdb, const char *values, const char *insert)
Definition: package.c:745

Definition at line 825 of file package.c.

◆ add_component_entry

#define add_component_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "Component", hdb, values, \
"INSERT INTO `Component` " \
"(`Component`, `ComponentId`, `Directory_`, " \
"`Attributes`, `Condition`, `KeyPath`) VALUES( %s )")
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
static UINT add_entry(const char *file, int line, const char *type, MSIHANDLE hdb, const char *values, const char *insert)
Definition: package.c:745

Definition at line 759 of file package.c.

◆ add_control_entry

#define add_control_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "Control", hdb, values, \
"INSERT INTO `Control` " \
"(`Dialog_`, `Control`, `Type`, `X`, `Y`, `Width`, `Height`, `Attributes`, `Text`) VALUES( %s )");
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
static UINT add_entry(const char *file, int line, const char *type, MSIHANDLE hdb, const char *values, const char *insert)
Definition: package.c:745

Definition at line 842 of file package.c.

◆ add_controlevent_entry

#define add_controlevent_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "ControlEvent", hdb, values, \
"INSERT INTO `ControlEvent` " \
"(`Dialog_`, `Control_`, `Event`, `Argument`, `Condition`, `Ordering`) VALUES( %s )");
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
static UINT add_entry(const char *file, int line, const char *type, MSIHANDLE hdb, const char *values, const char *insert)
Definition: package.c:745

Definition at line 846 of file package.c.

◆ add_custom_action_entry

#define add_custom_action_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "CustomAction", hdb, values, \
"INSERT INTO `CustomAction` " \
"(`Action`, `Type`, `Source`, `Target`) VALUES( %s )")
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
static UINT add_entry(const char *file, int line, const char *type, MSIHANDLE hdb, const char *values, const char *insert)
Definition: package.c:745

Definition at line 834 of file package.c.

◆ add_dialog_entry

#define add_dialog_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "Dialog", hdb, values, \
"INSERT INTO `Dialog` " \
"(`Dialog`, `HCentering`, `VCentering`, `Width`, `Height`, `Attributes`, `Control_First`) VALUES ( %s )")
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
static UINT add_entry(const char *file, int line, const char *type, MSIHANDLE hdb, const char *values, const char *insert)
Definition: package.c:745

Definition at line 838 of file package.c.

◆ add_directory_entry

#define add_directory_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "Directory", hdb, values, \
"INSERT INTO `Directory` " \
"(`Directory`,`Directory_Parent`,`DefaultDir`) VALUES( %s )")
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
static UINT add_entry(const char *file, int line, const char *type, MSIHANDLE hdb, const char *values, const char *insert)
Definition: package.c:745

Definition at line 764 of file package.c.

◆ add_drlocator_entry

#define add_drlocator_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "DrLocator", hdb, values, \
"INSERT INTO `DrLocator` " \
"(`Signature_`, `Parent`, `Path`, `Depth`) VALUES( %s )")
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
static UINT add_entry(const char *file, int line, const char *type, MSIHANDLE hdb, const char *values, const char *insert)
Definition: package.c:745

Definition at line 821 of file package.c.

◆ add_feature_components_entry

#define add_feature_components_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "FeatureComponents", hdb, values, \
"INSERT INTO `FeatureComponents` " \
"(`Feature_`, `Component_`) VALUES( %s )")
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
static UINT add_entry(const char *file, int line, const char *type, MSIHANDLE hdb, const char *values, const char *insert)
Definition: package.c:745

Definition at line 773 of file package.c.

◆ add_feature_entry

#define add_feature_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "Feature", hdb, values, \
"INSERT INTO `Feature` " \
"(`Feature`, `Feature_Parent`, `Title`, `Description`, " \
"`Display`, `Level`, `Directory_`, `Attributes`) VALUES( %s )")
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
static UINT add_entry(const char *file, int line, const char *type, MSIHANDLE hdb, const char *values, const char *insert)
Definition: package.c:745

Definition at line 768 of file package.c.

◆ add_file_entry

#define add_file_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "File", hdb, values, \
"INSERT INTO `File` " \
"(`File`, `Component_`, `FileName`, `FileSize`, " \
"`Version`, `Language`, `Attributes`, `Sequence`) VALUES( %s )")
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
static UINT add_entry(const char *file, int line, const char *type, MSIHANDLE hdb, const char *values, const char *insert)
Definition: package.c:745

Definition at line 777 of file package.c.

◆ add_inilocator_entry

#define add_inilocator_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "IniLocator", hdb, values, \
"INSERT INTO `IniLocator` " \
"(`Signature_`, `FileName`, `Section`, `Key`, `Field`, `Type`) " \
"VALUES( %s )")
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
static UINT add_entry(const char *file, int line, const char *type, MSIHANDLE hdb, const char *values, const char *insert)
Definition: package.c:745

Definition at line 829 of file package.c.

◆ add_install_execute_sequence_entry

#define add_install_execute_sequence_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "InstallExecuteSequence", hdb, values, \
"INSERT INTO `InstallExecuteSequence` " \
"(`Action`, `Condition`, `Sequence`) VALUES( %s )")
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
static UINT add_entry(const char *file, int line, const char *type, MSIHANDLE hdb, const char *values, const char *insert)
Definition: package.c:745

Definition at line 805 of file package.c.

◆ add_install_ui_sequence_entry

#define add_install_ui_sequence_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "InstallUISequence", hdb, values, \
"INSERT INTO `InstallUISequence` " \
"(`Action`, `Condition`, `Sequence`) VALUES( %s )")
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
static UINT add_entry(const char *file, int line, const char *type, MSIHANDLE hdb, const char *values, const char *insert)
Definition: package.c:745

Definition at line 809 of file package.c.

◆ add_launchcondition_entry

#define add_launchcondition_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "LaunchCondition", hdb, values, \
"INSERT INTO `LaunchCondition` " \
"(`Condition`, `Description`) VALUES( %s )")
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
static UINT add_entry(const char *file, int line, const char *type, MSIHANDLE hdb, const char *values, const char *insert)
Definition: package.c:745

Definition at line 792 of file package.c.

◆ add_media_entry

#define add_media_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "Media", hdb, values, \
"INSERT INTO `Media` " \
"(`DiskId`, `LastSequence`, `DiskPrompt`, " \
"`Cabinet`, `VolumeLabel`, `Source`) VALUES( %s )")
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
static UINT add_entry(const char *file, int line, const char *type, MSIHANDLE hdb, const char *values, const char *insert)
Definition: package.c:745

Definition at line 813 of file package.c.

◆ add_property_entry

#define add_property_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "Property", hdb, values, \
"INSERT INTO `Property` (`Property`, `Value`) VALUES( %s )")
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
static UINT add_entry(const char *file, int line, const char *type, MSIHANDLE hdb, const char *values, const char *insert)
Definition: package.c:745

Definition at line 796 of file package.c.

◆ add_signature_entry

#define add_signature_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "Signature", hdb, values, \
"INSERT INTO `Signature` " \
"(`Signature`, `FileName`, `MinVersion`, `MaxVersion`," \
" `MinSize`, `MaxSize`, `MinDate`, `MaxDate`, `Languages`) " \
"VALUES( %s )")
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
static UINT add_entry(const char *file, int line, const char *type, MSIHANDLE hdb, const char *values, const char *insert)
Definition: package.c:745

Definition at line 786 of file package.c.

◆ add_upgrade_entry

#define add_upgrade_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "Upgrade", hdb, values, \
"INSERT INTO `Upgrade` " \
"(`UpgradeCode`, `VersionMin`, `VersionMax`, `Language`, `Attributes`, `Remove`, `ActionProperty`) VALUES( %s )");
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
static UINT add_entry(const char *file, int line, const char *type, MSIHANDLE hdb, const char *values, const char *insert)
Definition: package.c:745

Definition at line 854 of file package.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 22 of file package.c.

◆ GET_PROC

#define GET_PROC (   mod,
  func 
)    p ## func = (void*)GetProcAddress(mod, #func);

◆ ok_sequence

#define ok_sequence (   exp,
  contx,
  todo 
)    ok_sequence_((exp), (contx), (todo), __FILE__, __LINE__)

Definition at line 8895 of file package.c.

◆ roundoffs

#define roundoffs (   a,
  b,
  r 
)    (((BYTE *)(b) - (BYTE *)(a) + ((r) - 1)) & ~((r) - 1))

Definition at line 1009 of file package.c.

◆ roundpos

#define roundpos (   a,
  b,
  r 
)    (((BYTE *)(a)) + roundoffs(a, b, r))

Definition at line 1010 of file package.c.

◆ test_file_access

#define test_file_access (   file,
  ares 
)    _test_file_access(file, ares, __LINE__)

Definition at line 7747 of file package.c.

◆ update_ProductCode_property

#define update_ProductCode_property (   hdb,
  value 
)
Value:
add_entry(__FILE__, __LINE__, "Property", hdb, value, \
"UPDATE `Property` SET `Value` = '%s' WHERE `Property` = 'ProductCode'")
Definition: pdh_main.c:93
static UINT add_entry(const char *file, int line, const char *type, MSIHANDLE hdb, const char *values, const char *insert)
Definition: package.c:745

Definition at line 802 of file package.c.

◆ update_ProductVersion_property

#define update_ProductVersion_property (   hdb,
  value 
)
Value:
add_entry(__FILE__, __LINE__, "Property", hdb, value, \
"UPDATE `Property` SET `Value` = '%s' WHERE `Property` = 'ProductVersion'")
Definition: pdh_main.c:93
static UINT add_entry(const char *file, int line, const char *type, MSIHANDLE hdb, const char *values, const char *insert)
Definition: package.c:745

Definition at line 799 of file package.c.

Typedef Documentation

◆ VS_VERSIONINFO

Function Documentation

◆ _test_file_access()

static void _test_file_access ( LPCSTR  file,
const struct access_res ares,
DWORD  line 
)
static

Definition at line 7704 of file package.c.

7705 {
7706  DWORD access = 0, share = 0;
7707  DWORD lasterr;
7708  HANDLE hfile;
7709  int i, j, idx = 0;
7710 
7711  for (i = 0; i < 4; i++)
7712  {
7713  if (i == 0) access = 0;
7714  if (i == 1) access = GENERIC_READ;
7715  if (i == 2) access = GENERIC_WRITE;
7716  if (i == 3) access = GENERIC_READ | GENERIC_WRITE;
7717 
7718  for (j = 0; j < 4; j++)
7719  {
7720  if (ares[idx].ignore)
7721  continue;
7722 
7723  if (j == 0) share = 0;
7724  if (j == 1) share = FILE_SHARE_READ;
7725  if (j == 2) share = FILE_SHARE_WRITE;
7726  if (j == 3) share = FILE_SHARE_READ | FILE_SHARE_WRITE;
7727 
7728  SetLastError(0xdeadbeef);
7729  hfile = CreateFileA(file, access, share, NULL, OPEN_EXISTING,
7731  lasterr = GetLastError();
7732 
7733  ok((hfile != INVALID_HANDLE_VALUE) == ares[idx].gothandle,
7734  "(%lu, handle, %d): Expected %d, got %d\n",
7735  line, idx, ares[idx].gothandle,
7736  (hfile != INVALID_HANDLE_VALUE));
7737 
7738  ok(lasterr == ares[idx].lasterr, "(%lu, lasterr, %u): Expected %lu, got %lu\n",
7739  line, idx, ares[idx].lasterr, lasterr);
7740 
7741  CloseHandle(hfile);
7742  idx++;
7743  }
7744  }
7745 }
#define CloseHandle
Definition: compat.h:598
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_SHARE_READ
Definition: compat.h:136
#define GENERIC_WRITE
Definition: nt_native.h:90
unsigned int idx
Definition: utils.c:41
Definition: parser.c:48
#define OPEN_EXISTING
Definition: compat.h:634
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 GLint GLint j
Definition: glfuncs.h:250
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:611
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define GENERIC_READ
Definition: compat.h:135
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
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:599
Definition: fci.c:126

◆ add_entry()

static UINT add_entry ( const char file,
int  line,
const char type,
MSIHANDLE  hdb,
const char values,
const char insert 
)
inlinestatic

Definition at line 745 of file package.c.

746 {
747  char *query;
748  UINT sz, r;
749 
750  sz = strlen(values) + strlen(insert) + 1;
751  query = malloc(sz);
753  r = run_query(hdb, query);
754  free(query);
755  ok_(file, line)(r == ERROR_SUCCESS, "failed to insert into %s table: %u\n", type, r);
756  return r;
757 }
#define ERROR_SUCCESS
Definition: deptool.c:10
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define free
Definition: debug_ros.c:5
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
static int insert
Definition: xmllint.c:144
#define sprintf(buf, format,...)
Definition: sprintf.c:55
Definition: parser.c:48
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:405
unsigned int UINT
Definition: ndis.h:50
#define malloc
Definition: debug_ros.c:4
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLenum query
Definition: glext.h:7781
#define ok_(x1, x2)
Definition: atltest.h:61
Definition: fci.c:126

◆ add_message()

static void add_message ( const struct externalui_message msg)
static

Definition at line 8798 of file package.c.

8799 {
8800  if (!sequence)
8801  {
8802  sequence_size = 10;
8803  sequence = malloc(sequence_size * sizeof(*sequence));
8804  }
8806  {
8807  sequence_size *= 2;
8809  }
8810 
8811  assert(sequence);
8812  sequence[sequence_count++] = *msg;
8813 }
#define realloc
Definition: debug_ros.c:6
static int sequence_size
Definition: package.c:8796
#define assert(x)
Definition: debug.h:53
static struct externalui_message * sequence
Definition: package.c:8795
static int sequence_count
Definition: package.c:8796
#define msg(x)
Definition: auth_time.c:54
#define malloc
Definition: debug_ros.c:4

Referenced by externalui_message_callback(), externalui_message_string_callback(), and ok_sequence_().

◆ add_reglocator_entry()

static UINT add_reglocator_entry ( MSIHANDLE  hdb,
const char sig,
UINT  root,
const char path,
const char name,
UINT  type 
)
static

Definition at line 858 of file package.c.

860 {
861  const char insert[] =
862  "INSERT INTO `RegLocator` (`Signature_`, `Root`, `Key`, `Name`, `Type`) "
863  "VALUES( '%s', %u, '%s', '%s', %u )";
864  char *query;
865  UINT sz, r;
866 
867  sz = strlen( sig ) + 10 + strlen( path ) + strlen( name ) + 10 + sizeof( insert );
868  query = malloc( sz );
869  sprintf( query, insert, sig, root, path, name, type );
870  r = run_query( hdb, query );
871  free( query );
872  ok(r == ERROR_SUCCESS, "failed to insert into reglocator table: %u\n", r); \
873  return r;
874 }
#define ERROR_SUCCESS
Definition: deptool.c:10
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define free
Definition: debug_ros.c:5
static int insert
Definition: xmllint.c:144
#define sprintf(buf, format,...)
Definition: sprintf.c:55
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:405
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
Definition: name.c:38
#define malloc
Definition: debug_ros.c:4
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLenum query
Definition: glext.h:7781

Referenced by test_appsearch(), test_appsearch_drlocator(), test_appsearch_reglocator(), and test_ccpsearch().

◆ BOOL()

static BOOL ( WINAPI pIsWow64Process)
static

◆ check_prop()

static void check_prop ( MSIHANDLE  hpkg,
const char prop,
const char expect,
int  match_case 
)
static

Definition at line 2140 of file package.c.

2141 {
2142  char buffer[MAX_PATH] = "x";
2143  DWORD sz = sizeof(buffer);
2144  UINT r = MsiGetPropertyA(hpkg, prop, buffer, &sz);
2145  ok(!r, "'%s': got %u\n", prop, r);
2146  ok(sz == lstrlenA(buffer), "'%s': expected %u, got %lu\n", prop, lstrlenA(buffer), sz);
2147  if (match_case)
2148  ok(!strcmp(buffer, expect), "'%s': expected '%s', got '%s'\n", prop, expect, buffer);
2149  else
2150  ok(!_stricmp(buffer, expect), "'%s': expected '%s', got '%s'\n", prop, expect, buffer);
2151 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint buffer
Definition: glext.h:5915
UINT WINAPI MsiGetPropertyA(MSIHANDLE hinst, const char *name, char *buf, DWORD *sz)
Definition: package.c:2313
#define _stricmp
Definition: cat.c:22
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define ok(value,...)
Definition: atltest.h:57
#define expect(expected, got)
Definition: combo.c:36
unsigned int UINT
Definition: ndis.h:50
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

Referenced by test_installprops(), and test_props().

◆ create_actiontext_table()

static UINT create_actiontext_table ( MSIHANDLE  hdb)
static

Definition at line 717 of file package.c.

718 {
719  UINT r = run_query(hdb,
720  "CREATE TABLE `ActionText` ("
721  "`Action` CHAR(72) NOT NULL, "
722  "`Description` CHAR(64) LOCALIZABLE, "
723  "`Template` CHAR(128) LOCALIZABLE "
724  "PRIMARY KEY `Action`)");
725  ok(r == ERROR_SUCCESS, "Failed to create ActionText table: %u\n", r);
726  return r;
727 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:405
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50

Referenced by test_externalui_message().

◆ create_appsearch_table()

static UINT create_appsearch_table ( MSIHANDLE  hdb)
static

Definition at line 495 of file package.c.

496 {
497  UINT r = run_query( hdb,
498  "CREATE TABLE `AppSearch` ("
499  "`Property` CHAR(72) NOT NULL, "
500  "`Signature_` CHAR(72) NOT NULL "
501  "PRIMARY KEY `Property`, `Signature_`)" );
502  ok(r == ERROR_SUCCESS, "Failed to create AppSearch table: %u\n", r);
503  return r;
504 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:405
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50

Referenced by test_appsearch(), test_appsearch_complocator(), test_appsearch_drlocator(), test_appsearch_inilocator(), test_appsearch_reglocator(), and test_complocator().

◆ create_ccpsearch_table()

static UINT create_ccpsearch_table ( MSIHANDLE  hdb)
static

Definition at line 599 of file package.c.

600 {
601  UINT r = run_query( hdb,
602  "CREATE TABLE `CCPSearch` ("
603  "`Signature_` CHAR(72) NOT NULL "
604  "PRIMARY KEY `Signature_`)" );
605  ok(r == ERROR_SUCCESS, "Failed to create CCPSearch table: %u\n", r);
606  return r;
607 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:405
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50

Referenced by test_ccpsearch().

◆ create_complocator_table()

static UINT create_complocator_table ( MSIHANDLE  hdb)
static

Definition at line 622 of file package.c.

623 {
624  UINT r = run_query( hdb,
625  "CREATE TABLE `CompLocator` ("
626  "`Signature_` CHAR(72) NOT NULL, "
627  "`ComponentId` CHAR(38) NOT NULL, "
628  "`Type` SHORT "
629  "PRIMARY KEY `Signature_`)" );
630  ok(r == ERROR_SUCCESS, "Failed to create CompLocator table: %u\n", r);
631  return r;
632 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:405
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50

Referenced by test_appsearch_complocator(), and test_complocator().

◆ create_component_table()

static UINT create_component_table ( MSIHANDLE  hdb)
static

Definition at line 421 of file package.c.

422 {
423  UINT r = run_query( hdb,
424  "CREATE TABLE `Component` ( "
425  "`Component` CHAR(72) NOT NULL, "
426  "`ComponentId` CHAR(38), "
427  "`Directory_` CHAR(72) NOT NULL, "
428  "`Attributes` SHORT NOT NULL, "
429  "`Condition` CHAR(255), "
430  "`KeyPath` CHAR(72) "
431  "PRIMARY KEY `Component`)" );
432  ok(r == ERROR_SUCCESS, "Failed to create Component table: %u\n", r);
433  return r;
434 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:405
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50

Referenced by test_costs(), test_featureparents(), test_formatrecord_tables(), test_removefiles(), test_settargetpath(), and test_states().

◆ create_control_table()

static UINT create_control_table ( MSIHANDLE  hdb)
static

Definition at line 681 of file package.c.

682 {
683  UINT r = run_query(hdb,
684  "CREATE TABLE `Control` ("
685  "`Dialog_` CHAR(72) NOT NULL, "
686  "`Control` CHAR(50) NOT NULL, "
687  "`Type` CHAR(20) NOT NULL, "
688  "`X` SHORT NOT NULL, "
689  "`Y` SHORT NOT NULL, "
690  "`Width` SHORT NOT NULL, "
691  "`Height` SHORT NOT NULL, "
692  "`Attributes` LONG, "
693  "`Property` CHAR(50), "
694  "`Text` CHAR(0) LOCALIZABLE, "
695  "`Control_Next` CHAR(50), "
696  "`Help` CHAR(255) LOCALIZABLE "
697  "PRIMARY KEY `Dialog_`, `Control`)");
698  ok(r == ERROR_SUCCESS, "Failed to create Control table: %u\n", r);
699  return r;
700 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:405
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50

Referenced by test_controlevent(), and test_externalui_message().

◆ create_controlevent_table()

static UINT create_controlevent_table ( MSIHANDLE  hdb)
static

Definition at line 702 of file package.c.

703 {
704  UINT r = run_query(hdb,
705  "CREATE TABLE `ControlEvent` ("
706  "`Dialog_` CHAR(72) NOT NULL, "
707  "`Control_` CHAR(50) NOT NULL, "
708  "`Event` CHAR(50) NOT NULL, "
709  "`Argument` CHAR(255) NOT NULL, "
710  "`Condition` CHAR(255), "
711  "`Ordering` SHORT "
712  "PRIMARY KEY `Dialog_`, `Control_`, `Event`, `Argument`, `Condition`)");
713  ok(r == ERROR_SUCCESS, "Failed to create ControlEvent table: %u\n", r);
714  return r;
715 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:405
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50

Referenced by test_controlevent().

◆ create_custom_action_table()

static UINT create_custom_action_table ( MSIHANDLE  hdb)
static

Definition at line 649 of file package.c.

650 {
651  UINT r = run_query( hdb,
652  "CREATE TABLE `CustomAction` ("
653  "`Action` CHAR(72) NOT NULL, "
654  "`Type` SHORT NOT NULL, "
655  "`Source` CHAR(75), "
656  "`Target` CHAR(255) "
657  "PRIMARY KEY `Action`)" );
658  ok(r == ERROR_SUCCESS, "Failed to create CustomAction table: %u\n", r);
659  return r;
660 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:405
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50

Referenced by test_controlevent(), test_formatrecord_tables(), test_property_table(), and test_states().

◆ create_dialog_table()

static UINT create_dialog_table ( MSIHANDLE  hdb)
static

Definition at line 662 of file package.c.

663 {
664  UINT r = run_query(hdb,
665  "CREATE TABLE `Dialog` ("
666  "`Dialog` CHAR(72) NOT NULL, "
667  "`HCentering` SHORT NOT NULL, "
668  "`VCentering` SHORT NOT NULL, "
669  "`Width` SHORT NOT NULL, "
670  "`Height` SHORT NOT NULL, "
671  "`Attributes` LONG, "
672  "`Title` CHAR(128) LOCALIZABLE, "
673  "`Control_First` CHAR(50) NOT NULL, "
674  "`Control_Default` CHAR(50), "
675  "`Control_Cancel` CHAR(50) "
676  "PRIMARY KEY `Dialog`)");
677  ok(r == ERROR_SUCCESS, "Failed to create Dialog table: %u\n", r);
678  return r;
679 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:405
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50

Referenced by test_controlevent(), and test_externalui_message().

◆ create_drlocator_table()

static UINT create_drlocator_table ( MSIHANDLE  hdb)
static

Definition at line 609 of file package.c.

610 {
611  UINT r = run_query( hdb,
612  "CREATE TABLE `DrLocator` ("
613  "`Signature_` CHAR(72) NOT NULL, "
614  "`Parent` CHAR(72), "
615  "`Path` CHAR(255), "
616  "`Depth` SHORT "
617  "PRIMARY KEY `Signature_`, `Parent`, `Path`)" );
618  ok(r == ERROR_SUCCESS, "Failed to create DrLocator table: %u\n", r);
619  return r;
620 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:405
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50

Referenced by test_appsearch(), test_appsearch_drlocator(), and test_ccpsearch().

◆ create_feature_components_table()

static UINT create_feature_components_table ( MSIHANDLE  hdb)
static

Definition at line 453 of file package.c.

454 {
455  UINT r = run_query( hdb,
456  "CREATE TABLE `FeatureComponents` ( "
457  "`Feature_` CHAR(38) NOT NULL, "
458  "`Component_` CHAR(72) NOT NULL "
459  "PRIMARY KEY `Feature_`, `Component_` )" );
460  ok(r == ERROR_SUCCESS, "Failed to create FeatureComponents table: %u\n", r);
461  return r;
462 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:405
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50

Referenced by test_costs(), test_featureparents(), test_formatrecord_tables(), test_removefiles(), test_settargetpath(), and test_states().

◆ create_feature_table()

static UINT create_feature_table ( MSIHANDLE  hdb)
static

Definition at line 436 of file package.c.

437 {
438  UINT r = run_query( hdb,
439  "CREATE TABLE `Feature` ( "
440  "`Feature` CHAR(38) NOT NULL, "
441  "`Feature_Parent` CHAR(38), "
442  "`Title` CHAR(64), "
443  "`Description` CHAR(255), "
444  "`Display` SHORT NOT NULL, "
445  "`Level` SHORT NOT NULL, "
446  "`Directory_` CHAR(72), "
447  "`Attributes` SHORT NOT NULL "
448  "PRIMARY KEY `Feature`)" );
449  ok(r == ERROR_SUCCESS, "Failed to create Feature table: %u\n", r);
450  return r;
451 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:405
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50

Referenced by test_costs(), test_featureparents(), test_formatrecord_tables(), test_removefiles(), test_settargetpath(), and test_states().

◆ create_file_data()

static void create_file_data ( LPCSTR  name,
LPCSTR  data 
)
static

Definition at line 976 of file package.c.

977 {
978  HANDLE file;
979  DWORD written;
980 
982  ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
983  if (file == INVALID_HANDLE_VALUE)
984  return;
985 
986  WriteFile(file, data, strlen(data), &written, NULL);
987  WriteFile(file, "\n", strlen("\n"), &written, NULL);
988 
989  CloseHandle(file);
990 }
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
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
#define GENERIC_WRITE
Definition: nt_native.h:90
const char file[]
Definition: icontest.c:11
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define CREATE_ALWAYS
Definition: disk.h:72
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
Definition: name.c:38
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:599
Definition: fci.c:126

Referenced by create_test_file(), test_controlevent(), test_externalui_message(), and test_top_level_action().

◆ create_file_table()

static UINT create_file_table ( MSIHANDLE  hdb)
static

Definition at line 464 of file package.c.

465 {
466  UINT r = run_query( hdb,
467  "CREATE TABLE `File` ("
468  "`File` CHAR(72) NOT NULL, "
469  "`Component_` CHAR(72) NOT NULL, "
470  "`FileName` CHAR(255) NOT NULL, "
471  "`FileSize` LONG NOT NULL, "
472  "`Version` CHAR(72), "
473  "`Language` CHAR(20), "
474  "`Attributes` SHORT, "
475  "`Sequence` SHORT NOT NULL "
476  "PRIMARY KEY `File`)" );
477  ok(r == ERROR_SUCCESS, "Failed to create File table: %u\n", r);
478  return r;
479 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:405
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50

Referenced by test_costs(), test_featureparents(), test_formatrecord_tables(), test_removefiles(), test_settargetpath(), and test_states().

◆ create_file_with_version()

static BOOL create_file_with_version ( const CHAR name,
LONG  ms,
LONG  ls 
)
static

Definition at line 1012 of file package.c.

1013 {
1014  VS_VERSIONINFO *pVerInfo;
1015  VS_FIXEDFILEINFO *pFixedInfo;
1016  LPBYTE buffer, ofs;
1017  CHAR path[MAX_PATH];
1018  DWORD handle, size;
1019  HANDLE resource;
1020  BOOL ret = FALSE;
1021 
1023  /* Some dlls can't be updated on Vista/W2K8 */
1024  lstrcatA(path, "\\version.dll");
1025 
1026  CopyFileA(path, name, FALSE);
1027 
1029  buffer = malloc(size);
1030 
1032 
1033  pVerInfo = (VS_VERSIONINFO *)buffer;
1034  ofs = (BYTE *)&pVerInfo->szKey[lstrlenW(pVerInfo->szKey) + 1];
1035  pFixedInfo = (VS_FIXEDFILEINFO *)roundpos(pVerInfo, ofs, 4);
1036 
1037  pFixedInfo->dwFileVersionMS = ms;
1038  pFixedInfo->dwFileVersionLS = ls;
1039  pFixedInfo->dwProductVersionMS = ms;
1040  pFixedInfo->dwProductVersionLS = ls;
1041 
1043  if (!resource)
1044  goto done;
1045 
1048  goto done;
1049 
1051  goto done;
1052 
1053  ret = TRUE;
1054 
1055 done:
1056  free(buffer);
1057  return ret;
1058 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
BOOL WINAPI UpdateResourceA(HANDLE hUpdate, LPCSTR lpType, LPCSTR lpName, WORD wLanguage, LPVOID lpData, DWORD cbData)
Definition: res.c:1738
#define TRUE
Definition: types.h:120
#define LANG_NEUTRAL
Definition: nls.h:22
char CHAR
Definition: xmlstorage.h:175
#define free
Definition: debug_ros.c:5
DWORD dwFileVersionLS
Definition: compat.h:762
UINT WINAPI GetSystemDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2283
GLuint buffer
Definition: glext.h:5915
BOOL WINAPI CopyFileA(IN LPCSTR lpExistingFileName, IN LPCSTR lpNewFileName, IN BOOL bFailIfExists)
Definition: copy.c:404
int resource
Definition: rdpsnd_sgi.c:44
#define SUBLANG_NEUTRAL
Definition: nls.h:167
#define lstrlenW
Definition: compat.h:609
void ls(int argc, const char *argv[])
Definition: cmds.c:1136
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define RT_VERSION
Definition: pedump.c:376
const char * LPCSTR
Definition: xmlstorage.h:183
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
GLsizeiptr size
Definition: glext.h:5919
DWORD WINAPI GetFileVersionInfoSizeA(LPCSTR filename, LPDWORD handle)
Definition: version.c:619
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD dwFileVersionMS
Definition: compat.h:761
BOOL WINAPI GetFileVersionInfoA(LPCSTR filename, DWORD handle, DWORD datasize, LPVOID data)
Definition: version.c:853
int ret
#define roundpos(a, b, r)
Definition: package.c:1010
unsigned char BYTE
Definition: xxhash.c:193
DWORD dwProductVersionLS
Definition: compat.h:764
#define VS_VERSION_INFO
HANDLE WINAPI BeginUpdateResourceA(LPCSTR pFileName, BOOL bDeleteExistingResources)
Definition: res.c:1657
Definition: name.c:38
#define MAKELANGID(p, s)
Definition: nls.h:15
#define malloc
Definition: debug_ros.c:4
DWORD dwProductVersionMS
Definition: compat.h:763
WCHAR szKey[17]
Definition: fusionpriv.h:382
BOOL WINAPI EndUpdateResourceA(HANDLE hUpdate, BOOL fDiscard)
Definition: res.c:1697

Referenced by test_appsearch_complocator(), test_appsearch_drlocator(), test_appsearch_inilocator(), and test_appsearch_reglocator().

◆ create_inilocator_table()

static UINT create_inilocator_table ( MSIHANDLE  hdb)
static

Definition at line 634 of file package.c.

635 {
636  UINT r = run_query( hdb,
637  "CREATE TABLE `IniLocator` ("
638  "`Signature_` CHAR(72) NOT NULL, "
639  "`FileName` CHAR(255) NOT NULL, "
640  "`Section` CHAR(96)NOT NULL, "
641  "`Key` CHAR(128)NOT NULL, "
642  "`Field` SHORT, "
643  "`Type` SHORT "
644  "PRIMARY KEY `Signature_`)" );
645  ok(r == ERROR_SUCCESS, "Failed to create IniLocator table: %u\n", r);
646  return r;
647 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:405
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50

Referenced by test_appsearch_inilocator().

◆ create_install_execute_sequence_table()

static UINT create_install_execute_sequence_table ( MSIHANDLE  hdb)
static

Definition at line 560 of file package.c.

561 {
562  UINT r = run_query( hdb,
563  "CREATE TABLE `InstallExecuteSequence` ("
564  "`Action` CHAR(72) NOT NULL, "
565  "`Condition` CHAR(255), "
566  "`Sequence` SHORT "
567  "PRIMARY KEY `Action`)" );
568  ok(r == ERROR_SUCCESS, "Failed to create InstallExecuteSequence table: %u\n", r);
569  return r;
570 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:405
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50

Referenced by test_costs(), test_states(), and test_top_level_action().

◆ create_install_ui_sequence_table()

static UINT create_install_ui_sequence_table ( MSIHANDLE  hdb)
static

Definition at line 572 of file package.c.

573 {
574  UINT r = run_query( hdb,
575  "CREATE TABLE `InstallUISequence` ("
576  "`Action` CHAR(72) NOT NULL, "
577  "`Condition` CHAR(255), "
578  "`Sequence` SHORT "
579  "PRIMARY KEY `Action`)" );
580  ok(r == ERROR_SUCCESS, "Failed to create InstallUISequence table: %u\n", r);
581  return r;
582 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:405
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50

Referenced by test_top_level_action().

◆ create_launchcondition_table()

static UINT create_launchcondition_table ( MSIHANDLE  hdb)
static

Definition at line 538 of file package.c.

539 {
540  UINT r = run_query( hdb,
541  "CREATE TABLE `LaunchCondition` ("
542  "`Condition` CHAR(255) NOT NULL, "
543  "`Description` CHAR(255) NOT NULL "
544  "PRIMARY KEY `Condition`)" );
545  ok(r == ERROR_SUCCESS, "Failed to create LaunchCondition table: %u\n", r);
546  return r;
547 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:405
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50

Referenced by test_launchconditions().

◆ create_media_table()

static UINT create_media_table ( MSIHANDLE  hdb)
static

Definition at line 584 of file package.c.

585 {
586  UINT r = run_query( hdb,
587  "CREATE TABLE `Media` ("
588  "`DiskId` SHORT NOT NULL, "
589  "`LastSequence` SHORT NOT NULL, "
590  "`DiskPrompt` CHAR(64), "
591  "`Cabinet` CHAR(255), "
592  "`VolumeLabel` CHAR(32), "
593  "`Source` CHAR(72) "
594  "PRIMARY KEY `DiskId`)" );
595  ok(r == ERROR_SUCCESS, "Failed to create Media table: %u\n", r);
596  return r;
597 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:405
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50

Referenced by test_costs(), and test_states().

◆ create_package_db()

static MSIHANDLE create_package_db ( void  )
static

Definition at line 921 of file package.c.

922 {
923  MSIHANDLE hdb = 0;
924  UINT res;
925 
927 
928  /* create an empty database */
930  ok( res == ERROR_SUCCESS , "Failed to create database %u\n", res );
931  if( res != ERROR_SUCCESS )
932  return hdb;
933 
934  res = MsiDatabaseCommit( hdb );
935  ok( res == ERROR_SUCCESS , "Failed to commit database\n" );
936 
937  res = set_summary_info(hdb);
938  ok( res == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", res);
939 
940  res = run_query( hdb,
941  "CREATE TABLE `Directory` ( "
942  "`Directory` CHAR(255) NOT NULL, "
943  "`Directory_Parent` CHAR(255), "
944  "`DefaultDir` CHAR(255) NOT NULL "
945  "PRIMARY KEY `Directory`)" );
946  ok( res == ERROR_SUCCESS , "Failed to create directory table\n" );
947 
948  return hdb;
949 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static const char msifile[]
Definition: package.c:37
unsigned long MSIHANDLE
Definition: winemsi.idl:24
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define MSIDBOPEN_CREATE
Definition: msiquery.h:69
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:405
static const WCHAR msifileW[]
Definition: package.c:38
UINT WINAPI MsiDatabaseCommit(MSIHANDLE hdb)
Definition: msiquery.c:963
#define ok(value,...)
Definition: atltest.h:57
static UINT set_summary_info(MSIHANDLE hdb)
Definition: package.c:876
UINT WINAPI MsiOpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIHANDLE *phDB)
Definition: database.c:298
unsigned int UINT
Definition: ndis.h:50
GLuint res
Definition: glext.h:9613

Referenced by test_appsearch(), test_appsearch_complocator(), test_appsearch_drlocator(), test_appsearch_inilocator(), test_appsearch_reglocator(), test_ccpsearch(), test_complocator(), test_condition(), test_controlevent(), test_costs(), test_createpackage(), test_doaction(), test_externalui(), test_externalui_message(), test_featureparents(), test_formatrecord2(), test_formatrecord_tables(), test_gettargetpath_bad(), test_installprops(), test_launchconditions(), test_MsiDatabaseCommit(), test_MsiGetSourcePath(), test_MsiSetProperty(), test_property_table(), test_props(), test_removefiles(), test_settargetpath(), test_shortlongsource(), test_sourcedir(), test_states(), and test_top_level_action().

◆ create_property_table()

static UINT create_property_table ( MSIHANDLE  hdb)
static

Definition at line 549 of file package.c.

550 {
551  UINT r = run_query( hdb,
552  "CREATE TABLE `Property` ("
553  "`Property` CHAR(72) NOT NULL, "
554  "`Value` CHAR(0) "
555  "PRIMARY KEY `Property`)" );
556  ok(r == ERROR_SUCCESS, "Failed to create Property table: %u\n", r);
557  return r;
558 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:405
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50

Referenced by test_costs(), test_MsiDatabaseCommit(), test_MsiGetProductProperty(), test_property_table(), test_props(), test_states(), and test_top_level_action().

◆ create_reglocator_table()

static UINT create_reglocator_table ( MSIHANDLE  hdb)
static

Definition at line 506 of file package.c.

507 {
508  UINT r = run_query( hdb,
509  "CREATE TABLE `RegLocator` ("
510  "`Signature_` CHAR(72) NOT NULL, "
511  "`Root` SHORT NOT NULL, "
512  "`Key` CHAR(255) NOT NULL, "
513  "`Name` CHAR(255), "
514  "`Type` SHORT "
515  "PRIMARY KEY `Signature_`)" );
516  ok(r == ERROR_SUCCESS, "Failed to create RegLocator table: %u\n", r);
517  return r;
518 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:405
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50

Referenced by test_appsearch(), test_appsearch_drlocator(), test_appsearch_reglocator(), and test_ccpsearch().

◆ create_remove_file_table()

static UINT create_remove_file_table ( MSIHANDLE  hdb)
static

Definition at line 481 of file package.c.

482 {
483  UINT r = run_query( hdb,
484  "CREATE TABLE `RemoveFile` ("
485  "`FileKey` CHAR(72) NOT NULL, "
486  "`Component_` CHAR(72) NOT NULL, "
487  "`FileName` CHAR(255) LOCALIZABLE, "
488  "`DirProperty` CHAR(72) NOT NULL, "
489  "`InstallMode` SHORT NOT NULL "
490  "PRIMARY KEY `FileKey`)" );
491  ok(r == ERROR_SUCCESS, "Failed to create RemoveFile table: %u\n", r);
492  return r;
493 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:405
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50

Referenced by test_removefiles().

◆ create_signature_table()

static UINT create_signature_table ( MSIHANDLE  hdb)
static

Definition at line 520 of file package.c.

521 {
522  UINT r = run_query( hdb,
523  "CREATE TABLE `Signature` ("
524  "`Signature` CHAR(72) NOT NULL, "
525  "`FileName` CHAR(255) NOT NULL, "
526  "`MinVersion` CHAR(20), "
527  "`MaxVersion` CHAR(20), "
528  "`MinSize` LONG, "
529  "`MaxSize` LONG, "
530  "`MinDate` LONG, "
531  "`MaxDate` LONG, "
532  "`Languages` CHAR(255) "
533  "PRIMARY KEY `Signature`)" );
534  ok(r == ERROR_SUCCESS, "Failed to create Signature table: %u\n", r);
535  return r;
536 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:405
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50

Referenced by test_appsearch(), test_appsearch_complocator(), test_appsearch_drlocator(), test_appsearch_inilocator(), test_appsearch_reglocator(), test_ccpsearch(), and test_complocator().

◆ create_test_file()

static void create_test_file ( const CHAR name)
static

Definition at line 992 of file package.c.

993 {
995 }
static void create_file_data(LPCSTR name, LPCSTR data)
Definition: package.c:976
Definition: name.c:38

Referenced by test_appsearch_complocator(), test_appsearch_drlocator(), test_appsearch_inilocator(), test_appsearch_reglocator(), test_complocator(), test_formatrecord_tables(), and test_removefiles().

◆ create_test_guid()

static void create_test_guid ( LPSTR  prodcode,
LPSTR  squashed 
)
static

Definition at line 244 of file package.c.

245 {
246  WCHAR guidW[MAX_PATH];
247  WCHAR squashedW[MAX_PATH];
248  GUID guid;
249  HRESULT hr;
250  int size;
251 
252  hr = CoCreateGuid(&guid);
253  ok(hr == S_OK, "Expected S_OK, got %#lx\n", hr);
254 
255  size = StringFromGUID2(&guid, guidW, MAX_PATH);
256  ok(size == 39, "Expected 39, got %#lx\n", hr);
257 
258  WideCharToMultiByte(CP_ACP, 0, guidW, size, prodcode, MAX_PATH, NULL, NULL);
259  squash_guid(guidW, squashedW);
260  WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
261 }
#define WideCharToMultiByte
Definition: compat.h:111
HRESULT hr
Definition: shlfolder.c:183
#define CP_ACP
Definition: compat.h:109
static BOOL squash_guid(LPCWSTR in, LPWSTR out)
Definition: package.c:212
const GUID * guid
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define MAX_PATH
Definition: compat.h:34
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2434
HRESULT WINAPI CoCreateGuid(GUID *pguid)
Definition: compobj.c:2206
#define S_OK
Definition: intsafe.h:52
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112

Referenced by test_MsiGetProductProperty().

◆ create_upgrade_table()

static UINT create_upgrade_table ( MSIHANDLE  hdb)
static

Definition at line 729 of file package.c.

730 {
731  UINT r = run_query( hdb,
732  "CREATE TABLE `Upgrade` ("
733  "`UpgradeCode` CHAR(38) NOT NULL, "
734  "`VersionMin` CHAR(20), "
735  "`VersionMax` CHAR(20), "
736  "`Language` CHAR(255), "
737  "`Attributes` SHORT, "
738  "`Remove` CHAR(255), "
739  "`ActionProperty` CHAR(72) NOT NULL "
740  "PRIMARY KEY `UpgradeCode`, `VersionMin`, `VersionMax`, `Language`)" );
741  ok(r == ERROR_SUCCESS, "Failed to create Upgrade table: %u\n", r);
742  return r;
743 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:405
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50

Referenced by test_states().

◆ delete_component_path()

static void delete_component_path ( LPCSTR  guid,
MSIINSTALLCONTEXT  context,
LPSTR  usersid 
)
static

Definition at line 329 of file package.c.

330 {
331  WCHAR guidW[MAX_PATH];
332  WCHAR squashedW[MAX_PATH];
334  CHAR squashed[MAX_PATH];
335  CHAR comppath[MAX_PATH + 81];
336  CHAR prodpath[MAX_PATH];
338 
339  if (is_wow64)
341 
342  MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
343  squash_guid(guidW, squashedW);
344  WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
345 
347  {
348  sprintf(comppath,
349  "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
350  "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed);
351  lstrcpyA(prodpath,
352  "SOFTWARE\\Classes\\Installer\\"
353  "Products\\3D0DAE300FACA1300AD792060BCDAA92");
354  }
356  {
357  sprintf(comppath,
358  "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
359  "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
360  sprintf(prodpath,
361  "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
362  "Installer\\%s\\Installer\\Products\\"
363  "7D2F387510109040002000060BECB6AB", usersid);
364  }
366  {
367  sprintf(comppath,
368  "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
369  "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
370  sprintf(prodpath,
371  "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
372  "Installer\\Managed\\%s\\Installer\\Products\\"
373  "7D2F387510109040002000060BECB6AB", usersid);
374  }
375 
376  MultiByteToWideChar(CP_ACP, 0, comppath, -1, substrW, MAX_PATH);
378 
379  MultiByteToWideChar(CP_ACP, 0, prodpath, -1, substrW, MAX_PATH);
381 }
#define WideCharToMultiByte
Definition: compat.h:111
Definition: http.c:7251
#define CP_ACP
Definition: compat.h:109
char CHAR
Definition: xmlstorage.h:175
static BOOL squash_guid(LPCWSTR in, LPWSTR out)
Definition: package.c:212
#define sprintf(buf, format,...)
Definition: sprintf.c:55
const GUID * guid
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
static LSTATUS package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey, REGSAM access)
Definition: package.c:146
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
static const WCHAR substrW[]
Definition: string.c:60
static BOOL is_wow64
Definition: package.c:36
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
ACCESS_MASK REGSAM
Definition: winreg.h:69
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by test_appsearch_complocator(), and test_complocator().

◆ delete_key()

static LONG delete_key ( HKEY  key,
LPCSTR  subkey,
REGSAM  access 
)
static

Definition at line 119 of file package.c.

120 {
121  if (pRegDeleteKeyExA)
122  return pRegDeleteKeyExA( key, subkey, access, 0 );
123  return RegDeleteKeyA( key, subkey );
124 }
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1222
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
Definition: copy.c:22

Referenced by test_appsearch(), and test_MsiGetProductProperty().

◆ delete_win_ini()

static void delete_win_ini ( LPCSTR  file)
static

Definition at line 4947 of file package.c.

4948 {
4949  CHAR path[MAX_PATH];
4950 
4952  lstrcatA(path, "\\");
4953  lstrcatA(path, file);
4954 
4955  DeleteFileA(path);
4956 }
char CHAR
Definition: xmlstorage.h:175
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
#define MAX_PATH
Definition: compat.h:34
UINT WINAPI GetWindowsDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2337
Definition: fci.c:126

Referenced by test_appsearch_inilocator().

◆ do_query()

static UINT do_query ( MSIHANDLE  hdb,
const char query,
MSIHANDLE phrec 
)
static

Definition at line 383 of file package.c.

384 {
385  MSIHANDLE hview = 0;
386  UINT r, ret;
387 
388  /* open a select query */
389  r = MsiDatabaseOpenViewA(hdb, query, &hview);
390  if (r != ERROR_SUCCESS)
391  return r;
392  r = MsiViewExecute(hview, 0);
393  if (r != ERROR_SUCCESS)
394  return r;
395  ret = MsiViewFetch(hview, phrec);
396  r = MsiViewClose(hview);
397  if (r != ERROR_SUCCESS)
398  return r;
399  r = MsiCloseHandle(hview);
400  if (r != ERROR_SUCCESS)
401  return r;
402  return ret;
403 }
UINT WINAPI MsiViewExecute(MSIHANDLE hView, MSIHANDLE hRec)
Definition: msiquery.c:518
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
UINT WINAPI MsiViewClose(MSIHANDLE hView)
Definition: msiquery.c:469
UINT WINAPI MsiDatabaseOpenViewA(MSIHANDLE hdb, const char *szQuery, MSIHANDLE *phView)
Definition: msiquery.c:88
unsigned long MSIHANDLE
Definition: winemsi.idl:24
UINT WINAPI MsiViewFetch(MSIHANDLE hView, MSIHANDLE *record)
Definition: msiquery.c:404
int ret
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:269
unsigned int UINT
Definition: ndis.h:50

Referenced by test_MsiSetProperty(), and test_property_table().

◆ externalui_callback()

static INT CALLBACK externalui_callback ( void context,
UINT  message_type,
LPCSTR  message 
)
static

Definition at line 8692 of file package.c.

8693 {
8694  externalui_ran = 1;
8695  ok(message_type == INSTALLMESSAGE_USER, "expected INSTALLMESSAGE_USER, got %08x\n", message_type);
8696  return 0;
8697 }
static int externalui_ran
Definition: package.c:8690
#define ok(value,...)
Definition: atltest.h:57

Referenced by test_externalui().

◆ externalui_message_callback()

static INT CALLBACK externalui_message_callback ( void context,
UINT  message,
MSIHANDLE  hrecord 
)
static

Definition at line 9055 of file package.c.

9056 {
9057  INT retval = context ? *((INT *)context) : 0;
9058  struct externalui_message msg;
9059  char buffer[256];
9060  DWORD length;
9061  UINT r;
9062  int i;
9063 
9064  msg.message = message;
9066  {
9067  /* trying to access the record seems to hang on some versions of Windows */
9068  msg.field_count = -1;
9069  add_message(&msg);
9070  return 1;
9071  }
9072  msg.field_count = MsiRecordGetFieldCount(hrecord);
9073  for (i = 0; i <= msg.field_count; i++)
9074  {
9075  length = sizeof(buffer);
9076  r = MsiRecordGetStringA(hrecord, i, buffer, &length);
9077  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
9078  memcpy(msg.field[i], buffer, min(100, length+1));
9079  }
9080 
9081  /* top-level actions dump a list of all set properties; skip them since they're inconsistent */
9082  if (message == (INSTALLMESSAGE_INFO|MB_ICONHAND) && msg.field_count > 0 && !strncmp(msg.field[0], "Property", 8))
9083  return retval;
9084 
9085  add_message(&msg);
9086 
9087  return retval;
9088 }
#define MB_ICONHAND
Definition: winuser.h:782
Definition: tftpd.h:59
#define ERROR_SUCCESS
Definition: deptool.c:10
UINT WINAPI MsiRecordGetStringA(MSIHANDLE handle, UINT iField, char *szValue, DWORD *pcchValue)
Definition: record.c:403
Definition: http.c:7251
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: glext.h:5579
static void add_message(const struct externalui_message *msg)
Definition: package.c:8798
GLuint buffer
Definition: glext.h:5915
int32_t INT
Definition: typedefs.h:58
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
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
#define ok(value,...)
Definition: atltest.h:57
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
#define msg(x)
Definition: auth_time.c:54
UINT WINAPI MsiRecordGetFieldCount(MSIHANDLE handle)
Definition: record.c:113

Referenced by test_controlevent(), test_externalui_message(), and test_top_level_action().

◆ externalui_message_string_callback()

static INT CALLBACK externalui_message_string_callback ( void context,
UINT  message,
LPCSTR  string 
)
static

Definition at line 9042 of file package.c.

9043 {
9044  INT retval = context ? *((INT *)context) : 0;
9045  struct externalui_message msg;
9046 
9047  msg.message = message;
9048  msg.field_count = 0;
9049  strcpy(msg.field[0], string);
9050  add_message(&msg);
9051 
9052  return retval;
9053 }
Definition: http.c:7251
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: glext.h:5579
static void add_message(const struct externalui_message *msg)
Definition: package.c:8798
int32_t INT
Definition: typedefs.h:58
#define msg(x)
Definition: auth_time.c:54
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388

Referenced by test_controlevent(), test_externalui_message(), and test_top_level_action().

◆ externalui_record_callback()

static INT CALLBACK externalui_record_callback ( void context,
UINT  message_type,
MSIHANDLE  hrecord 
)
static

Definition at line 8701 of file package.c.

8702 {
8703  INT retval = context ? *((INT *)context) : 0;
8704  UINT r;
8706  ok(message_type == INSTALLMESSAGE_USER, "expected INSTALLMESSAGE_USER, got %08x\n", message_type);
8707  r = MsiRecordGetFieldCount(hrecord);
8708  ok(r == 1, "expected 1, got %u\n", r);
8709  r = MsiRecordGetInteger(hrecord, 1);
8710  ok(r == 12345, "expected 12345, got %u\n", r);
8711  return retval;
8712 }
Definition: http.c:7251
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
int WINAPI MsiRecordGetInteger(MSIHANDLE handle, UINT iField)
Definition: record.c:237
int32_t INT
Definition: typedefs.h:58
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
UINT WINAPI MsiRecordGetFieldCount(MSIHANDLE handle)
Definition: record.c:113
static int externalui_record_ran
Definition: package.c:8699

Referenced by test_externalui().

◆ find_prop_in_property()

static BOOL find_prop_in_property ( MSIHANDLE  hdb,
LPCSTR  prop,
LPCSTR  val,
int  len 
)
static

Definition at line 2329 of file package.c.

2330 {
2331  MSIHANDLE hview, hrec;
2332  BOOL found = FALSE;
2333  CHAR buffer[MAX_PATH];
2334  DWORD sz;
2335  UINT r;
2336 
2337  r = MsiDatabaseOpenViewA(hdb, "SELECT * FROM `_Property`", &hview);
2338  ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
2339  r = MsiViewExecute(hview, 0);
2340  ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n");
2341 
2342  if (len < 0) len = lstrlenA(val);
2343 
2344  while (r == ERROR_SUCCESS && !found)
2345  {
2346  r = MsiViewFetch(hview, &hrec);
2347  if (r != ERROR_SUCCESS) break;
2348 
2349  sz = MAX_PATH;
2350  r = MsiRecordGetStringA(hrec, 1, buffer, &sz);
2351  if (r == ERROR_SUCCESS && !lstrcmpA(buffer, prop))
2352  {
2353  sz = MAX_PATH;
2354  r = MsiRecordGetStringA(hrec, 2, buffer, &sz);
2355  if (r == ERROR_SUCCESS && !memcmp(buffer, val, len) && !buffer[len])
2356  {
2357  ok(sz == len, "wrong size %lu\n", sz);
2358  found = TRUE;
2359  }
2360  }
2361 
2362  MsiCloseHandle(hrec);
2363  }
2364  MsiViewClose(hview);
2365  MsiCloseHandle(hview);
2366  return found;
2367 }
UINT WINAPI MsiViewExecute(MSIHANDLE hView, MSIHANDLE hRec)
Definition: msiquery.c:518
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define ERROR_SUCCESS
Definition: deptool.c:10
UINT WINAPI MsiRecordGetStringA(MSIHANDLE handle, UINT iField, char *szValue, DWORD *pcchValue)
Definition: record.c:403
#define TRUE
Definition: types.h:120
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
char CHAR
Definition: xmlstorage.h:175
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
GLuint buffer
Definition: glext.h:5915
UINT WINAPI MsiViewClose(MSIHANDLE hView)
Definition: msiquery.c:469
#define FALSE
Definition: types.h:117
UINT WINAPI MsiDatabaseOpenViewA(MSIHANDLE hdb, const char *szQuery, MSIHANDLE *phView)
Definition: msiquery.c:88
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long MSIHANDLE
Definition: winemsi.idl:24
GLuint GLfloat * val
Definition: glext.h:7180
UINT WINAPI MsiViewFetch(MSIHANDLE hView, MSIHANDLE *record)
Definition: msiquery.c:404
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:269
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50

Referenced by test_property_table().

◆ flush_sequence()

static void flush_sequence ( void  )
static

Definition at line 8815 of file package.c.

8816 {
8817  free(sequence);
8818  sequence = NULL;
8820 }
static int sequence_size
Definition: package.c:8796
#define free
Definition: debug_ros.c:5
static struct externalui_message * sequence
Definition: package.c:8795
static int sequence_count
Definition: package.c:8796
#define NULL
Definition: types.h:112

Referenced by ok_sequence_(), test_controlevent(), test_externalui_message(), and test_top_level_action().

◆ get_user_sid()

static char* get_user_sid ( void  )
static

Definition at line 126 of file package.c.

127 {
128  HANDLE token;
129  DWORD size = 0;
130  TOKEN_USER *user;
131  char *usersid = NULL;
132 
135 
136  user = malloc(size);
138  ConvertSidToStringSidA(user->User.Sid, &usersid);
139  free(user);
140 
142  return usersid;
143 }
#define CloseHandle
Definition: compat.h:598
#define free
Definition: debug_ros.c:5
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
GLsizeiptr size
Definition: glext.h:5919
#define TOKEN_QUERY
Definition: setypes.h:924
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI ConvertSidToStringSidA(PSID Sid, LPSTR *StringSid)
Definition: security.c:3436
#define GetCurrentProcess()
Definition: compat.h:618
#define NULL
Definition: types.h:112
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:413
#define malloc
Definition: debug_ros.c:4
void user(int argc, const char *argv[])
Definition: cmds.c:1350

Referenced by test_appsearch_complocator().

◆ init_functionpointers()

static STATEMGRSTATUS* static void init_functionpointers ( void  )
static

Definition at line 49 of file package.c.

50 {
51  HMODULE hmsi = GetModuleHandleA("msi.dll");
52  HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
53  HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
54  HMODULE hsrclient = LoadLibraryA("srclient.dll");
55 
56 #define GET_PROC(mod, func) \
57  p ## func = (void*)GetProcAddress(mod, #func);
58 
60 
61  GET_PROC(hadvapi32, RegDeleteKeyExA)
62  GET_PROC(hadvapi32, RegDeleteKeyExW)
64 
65  GET_PROC(hsrclient, SRRemoveRestorePoint);
66  GET_PROC(hsrclient, SRSetRestorePointA);
67 
68 #undef GET_PROC
69 }
INSTALLSTATE WINAPI MsiGetComponentPathExA(LPCSTR product, LPCSTR comp, LPCSTR usersid, MSIINSTALLCONTEXT ctx, LPSTR buf, LPDWORD buflen)
Definition: msi.c:2866
LONG WINAPI RegDeleteKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ REGSAM samDesired, _In_ DWORD Reserved)
Definition: reg.c:1252
static HINSTANCE hkernel32
Definition: process.c:66
LONG WINAPI RegDeleteKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ REGSAM samDesired, _In_ DWORD Reserved)
Definition: reg.c:1284
DWORD WINAPI SRRemoveRestorePoint(DWORD dwNumber)
Definition: srclient_main.c:71
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
BOOL WINAPI IsWow64Process(IN HANDLE hProcess, OUT PBOOL Wow64Process)
Definition: proc.c:1975
#define GET_PROC(mod, func)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
BOOL WINAPI SRSetRestorePointA(PRESTOREPOINTINFOA pRestorePtSpec, PSTATEMGRSTATUS pSMgrStatus)
Definition: sfc.c:54

Referenced by START_TEST().

◆ INSTALLSTATE()

static INSTALLSTATE ( WINAPI pMsiGetComponentPathExA)
static

◆ is_process_limited()

static BOOL is_process_limited ( void  )
static

Definition at line 71 of file package.c.

72 {
74  PSID Group = NULL;
75  BOOL IsInGroup;
76  HANDLE token;
77 
79  DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
80  !CheckTokenMembership(NULL, Group, &IsInGroup))
81  {
82  trace("Could not check if the current user is an administrator\n");
83  FreeSid(Group);
84  return FALSE;
85  }
86  FreeSid(Group);
87 
88  if (!IsInGroup)
89  {
93  0, 0, 0, 0, 0, 0, &Group) ||
94  !CheckTokenMembership(NULL, Group, &IsInGroup))
95  {
96  trace("Could not check if the current user is a power user\n");
97  return FALSE;
98  }
99  if (!IsInGroup)
100  {
101  /* Only administrators and power users can be powerful */
102  return TRUE;
103  }
104  }
105 
107  {
108  BOOL ret;
110  DWORD size;
111 
114  return (ret && type == TokenElevationTypeLimited);
115  }
116  return FALSE;
117 }
enum _TOKEN_ELEVATION_TYPE TOKEN_ELEVATION_TYPE
#define CloseHandle
Definition: compat.h:598
#define TRUE
Definition: types.h:120
_In_opt_ PSID Group
Definition: rtlfuncs.h:1632
BOOL WINAPI CheckTokenMembership(IN HANDLE ExistingTokenHandle, IN PSID SidToCheck, OUT PBOOL IsMember)
Definition: token.c:21
#define DOMAIN_ALIAS_RID_POWER_USERS
Definition: setypes.h:655
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
PVOID WINAPI FreeSid(PSID pSid)
Definition: security.c:700
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
#define SECURITY_NT_AUTHORITY
Definition: setypes.h:554
GLsizeiptr size
Definition: glext.h:5919
#define trace
Definition: atltest.h:70
#define SECURITY_BUILTIN_DOMAIN_RID
Definition: setypes.h:581
#define TOKEN_QUERY
Definition: setypes.h:924
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
static SID_IDENTIFIER_AUTHORITY NtAuthority
Definition: security.c:40
#define GetCurrentProcess()
Definition: compat.h:618
#define NULL
Definition: types.h:112
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
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
#define DOMAIN_ALIAS_RID_ADMINS
Definition: setypes.h:652
BOOL WINAPI AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount, DWORD nSubAuthority0, DWORD nSubAuthority1, DWORD nSubAuthority2, DWORD nSubAuthority3, DWORD nSubAuthority4, DWORD nSubAuthority5, DWORD nSubAuthority6, DWORD nSubAuthority7, PSID *pSid)
Definition: security.c:676

Referenced by test_appsearch_complocator(), and test_states().

◆ is_root()

static BOOL is_root ( const char path)
static

◆ LONG()

static LONG ( WINAPI pRegDeleteKeyExA)
static

◆ notify_system_change()

static BOOL notify_system_change ( DWORD  event_type,
STATEMGRSTATUS status 
)
static

Definition at line 1060 of file package.c.

1061 {
1062  RESTOREPOINTINFOA spec;
1063 
1064  spec.dwEventType = event_type;
1066  spec.llSequenceNumber = status->llSequenceNumber;
1067  lstrcpyA(spec.szDescription, "msitest restore point");
1068 
1069  return pSRSetRestorePointA(&spec, status);
1070 }
#define APPLICATION_INSTALL
CHAR szDescription[MAX_DESC]
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
Definition: ps.c:97

Referenced by START_TEST().

◆ ok_sequence_()

static void ok_sequence_ ( const struct externalui_message expected,
const char context,
BOOL  todo,
const char file,
int  line 
)
static

Definition at line 8822 of file package.c.

8824 {
8825  static const struct externalui_message end_of_sequence = {0};
8826  const struct externalui_message *actual;
8827  int failcount = 0;
8828  int i;
8829 
8830  add_message(&end_of_sequence);
8831 
8832  actual = sequence;
8833 
8834  while (expected->message && actual->message)
8835  {
8836  if (expected->message == actual->message)
8837  {
8838  if (expected->field_count < actual->field_count)
8839  {
8840  todo_wine_if (todo)
8841  ok_(file, line) (FALSE, "%s: in msg 0x%08x expecting field count %d got %d\n",
8842  context, expected->message, expected->field_count, actual->field_count);
8843  failcount++;
8844  }
8845 
8846  for (i = 0; i <= actual->field_count; i++)
8847  {
8848  if (expected->match[i] && strcmp(expected->field[i], actual->field[i]))
8849  {
8850  todo_wine_if (todo)
8851  ok_(file, line) (FALSE, "%s: in msg 0x%08x field %d: expected \"%s\", got \"%s\"\n",
8852  context, expected->message, i, expected->field[i], actual->field[i]);
8853  failcount++;
8854  }
8855  }
8856 
8857  expected++;
8858  actual++;
8859  }
8860  else if (expected->optional)
8861  {
8862  expected++;
8863  }
8864  else
8865  {
8866  todo_wine_if (todo)
8867  ok_(file, line) (FALSE, "%s: the msg 0x%08x was expected, but got msg 0x%08x instead\n",
8868  context, expected->message, actual->message);
8869  failcount++;
8870  if (todo)
8871  goto done;
8872  expected++;
8873  actual++;
8874  }
8875  }
8876 
8877  if (expected->message || actual->message)
8878  {
8879  todo_wine_if (todo)
8880  ok_(file, line) (FALSE, "%s: the msg sequence is not complete: expected %08x - actual %08x\n",
8881  context, expected->message, actual->message);
8882  failcount++;
8883  }
8884 
8885  if(todo && !failcount) /* succeeded yet marked todo */
8886  {
8887  todo_wine
8888  ok_(file, line)(TRUE, "%s: marked \"todo_wine\" but succeeds\n", context);
8889  }
8890 
8891 done:
8892  flush_sequence();
8893 }
#define TRUE
Definition: types.h:120
BOOL todo
Definition: filedlg.c:313
static void add_message(const struct externalui_message *msg)
Definition: package.c:8798
#define todo_wine
Definition: custom.c:79
static struct externalui_message * sequence
Definition: package.c:8795
#define FALSE
Definition: types.h:117
Definition: parser.c:48
#define todo_wine_if(is_todo)
Definition: custom.c:76
_In_opt_ PVOID _In_ ULONG _In_ PVOID context
Definition: wdfdriver.h:113
char field[4][100]
Definition: package.c:8790
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 void flush_sequence(void)
Definition: package.c:8815
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
BOOL expected
Definition: store.c:2063
#define ok_(x1, x2)
Definition: atltest.h:61
Definition: fci.c:126

◆ package_from_db()

static UINT package_from_db ( MSIHANDLE  hdb,
MSIHANDLE handle 
)
static

Definition at line 951 of file package.c.

952 {
953  UINT res;
954  CHAR szPackage[12];
955  MSIHANDLE hPackage;
956 
957  sprintf(szPackage, "#%lu", hdb);
958  res = MsiOpenPackageA(szPackage, &hPackage);
959  if (res != ERROR_SUCCESS)
960  {
961  MsiCloseHandle(hdb);
962  return res;
963  }
964 
965  res = MsiCloseHandle(hdb);
966  if (res != ERROR_SUCCESS)
967  {
968  MsiCloseHandle(hPackage);
969  return res;
970  }
971 
972  *handle = hPackage;
973  return ERROR_SUCCESS;
974 }
UINT WINAPI MsiOpenPackageA(LPCSTR szPackage, MSIHANDLE *phPackage)
Definition: package.c:1669
#define ERROR_SUCCESS
Definition: deptool.c:10
char CHAR
Definition: xmlstorage.h:175
#define sprintf(buf, format,...)
Definition: sprintf.c:55
unsigned long MSIHANDLE
Definition: winemsi.idl:24
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:269
unsigned int UINT
Definition: ndis.h:50
GLuint res
Definition: glext.h:9613

Referenced by test_appsearch(), test_appsearch_complocator(), test_appsearch_drlocator(), test_appsearch_inilocator(), test_appsearch_reglocator(), test_ccpsearch(), test_complocator(), test_condition(), test_controlevent(), test_createpackage(), test_doaction(), test_externalui(), test_externalui_message(), test_featureparents(), test_formatrecord2(), test_formatrecord_tables(), test_gettargetpath_bad(), test_installprops(), test_launchconditions(), test_MsiGetSourcePath(), test_MsiSetProperty(), test_property_table(), test_props(), test_removefiles(), test_settargetpath(), test_shortlongsource(), and test_states().

◆ package_RegDeleteTreeW()

static LSTATUS package_RegDeleteTreeW ( HKEY  hKey,
LPCWSTR  lpszSubKey,
REGSAM  access 
)
static

Definition at line 146 of file package.c.

147 {
148  LONG ret;
149  DWORD dwMaxSubkeyLen, dwMaxValueLen;
150  DWORD dwMaxLen, dwSize;
151  WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf;
152  HKEY hSubKey = hKey;
153 
154  if(lpszSubKey)
155  {
156  ret = RegOpenKeyExW(hKey, lpszSubKey, 0, access, &hSubKey);
157  if (ret) return ret;
158  }
159 
160  ret = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL,
161  &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
162  if (ret) goto cleanup;
163 
164  dwMaxSubkeyLen++;
165  dwMaxValueLen++;
166  dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
167  if (dwMaxLen > ARRAY_SIZE(szNameBuf))
168  {
169  /* Name too big: alloc a buffer for it */
170  if (!(lpszName = malloc(dwMaxLen * sizeof(WCHAR))))
171  {
173  goto cleanup;
174  }
175  }
176 
177  /* Recursively delete all the subkeys */
178  while (TRUE)
179  {
180  dwSize = dwMaxLen;
181  if (RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL,
182  NULL, NULL, NULL)) break;
183 
184  ret = package_RegDeleteTreeW(hSubKey, lpszName, access);
185  if (ret) goto cleanup;
186  }
187 
188  if (lpszSubKey)
189  {
190  if (pRegDeleteKeyExW)
191  ret = pRegDeleteKeyExW(hKey, lpszSubKey, access, 0);
192  else
193  ret = RegDeleteKeyW(hKey, lpszSubKey);
194  }
195  else
196  while (TRUE)
197  {
198  dwSize = dwMaxLen;
199  if (RegEnumValueW(hKey, 0, lpszName, &dwSize,
200  NULL, NULL, NULL, NULL)) break;
201 
202  ret = RegDeleteValueW(hKey, lpszName);
203  if (ret) goto cleanup;
204  }
205 
206 cleanup:
207  if (lpszName != szNameBuf) free(lpszName);
208  if (lpszSubKey) RegCloseKey(hSubKey);
209  return ret;
210 }
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
#define free
Definition: debug_ros.c:5
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1237
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
long LONG
Definition: pedump.c:60
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
Definition: reg.c:2853
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
static LSTATUS package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey, REGSAM access)
Definition: package.c:146
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3690
int ret
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2355
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
FxAutoRegKey hKey
#define ARRAY_SIZE(a)
Definition: main.h:24
#define NULL
Definition: types.h:112
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
char * cleanup(char *str)
Definition: wpickclick.c:99
#define malloc
Definition: debug_ros.c:4
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2527
#define RegCloseKey(hKey)
Definition: registry.h:47
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56

Referenced by delete_component_path().

◆ query_file_path()

static void query_file_path ( MSIHANDLE  hpkg,
LPCSTR  file,
LPSTR  buff 
)
static

Definition at line 1200 of file package.c.

1201 {
1202  UINT r;
1203  DWORD size;
1204  MSIHANDLE rec;
1205 
1206  rec = MsiCreateRecord( 1 );
1207  ok(rec, "MsiCreate record failed\n");
1208 
1209  r = MsiRecordSetStringA( rec, 0, file );
1210  ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
1211 
1212  size = MAX_PATH;
1213  r = MsiFormatRecordA( hpkg, rec, buff, &size );
1214  ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
1215 
1216  MsiCloseHandle( rec );
1217 }
MSIHANDLE WINAPI MsiCreateRecord(UINT cParams)
Definition: record.c:92
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
unsigned long MSIHANDLE
Definition: winemsi.idl:24
UINT WINAPI MsiFormatRecordA(MSIHANDLE hinst, MSIHANDLE hrec, char *buf, DWORD *sz)
Definition: format.c:955
GLsizeiptr size
Definition: glext.h:5919
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:269
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
static unsigned char buff[32768]
Definition: fatten.c:17
UINT WINAPI MsiRecordSetStringA(MSIHANDLE handle, UINT iField, const char *szValue)
Definition: record.c:549
Definition: fci.c:126

Referenced by test_settargetpath().

◆ remove_restore_point()

static void remove_restore_point ( DWORD  seq_number)
static

Definition at line 1072 of file package.c.

1073 {
1074  DWORD res;
1075 
1076  res = pSRRemoveRestorePoint(seq_number);
1077  if (res != ERROR_SUCCESS)
1078  trace("Failed to remove the restore point: %#lx\n", res);
1079 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define trace
Definition: atltest.h:70
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint res
Definition: glext.h:9613

Referenced by START_TEST().

◆ run_query()

static UINT run_query ( MSIHANDLE  hdb,
const char query 
)
static

Definition at line 405 of file package.c.

406 {
407  MSIHANDLE hview = 0;
408  UINT r;
409 
410  r = MsiDatabaseOpenViewA(hdb, query, &hview);
411  if( r != ERROR_SUCCESS )
412  return r;
413 
414  r = MsiViewExecute(hview, 0);
415  if( r == ERROR_SUCCESS )
416  r = MsiViewClose(hview);
417  MsiCloseHandle(hview);
418  return r;
419 }
UINT WINAPI MsiViewExecute(MSIHANDLE hView, MSIHANDLE hRec)
Definition: msiquery.c:518
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
UINT WINAPI MsiViewClose(MSIHANDLE hView)
Definition: msiquery.c:469
UINT WINAPI MsiDatabaseOpenViewA(MSIHANDLE hdb, const char *szQuery, MSIHANDLE *phView)
Definition: msiquery.c:88
unsigned long MSIHANDLE
Definition: winemsi.idl:24
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:269
unsigned int UINT
Definition: ndis.h:50

Referenced by add_entry(), add_reglocator_entry(), create_actiontext_table(), create_appsearch_table(), create_ccpsearch_table(), create_complocator_table(), create_component_table(), create_control_table(), create_controlevent_table(), create_custom_action_table(), create_dialog_table(), create_drlocator_table(), create_feature_components_table(), create_feature_table(), create_file_table(), create_inilocator_table(), create_install_execute_sequence_table(), create_install_ui_sequence_table(), create_launchcondition_table(), create_media_table(), create_package_db(), create_property_table(), create_reglocator_table(), create_remove_file_table(), create_signature_table(), create_upgrade_table(), test_externalui_message(), test_MsiGetProductProperty(), and test_property_table().

◆ search_absolute_directory()

static void search_absolute_directory ( LPSTR  absolute,
LPCSTR  relative 
)
static

Definition at line 5165 of file package.c.

5166 {
5167  int i, size;
5168  DWORD attr, drives;
5169 
5170  size = lstrlenA(relative);
5171  drives = GetLogicalDrives();
5172  lstrcpyA(absolute, "A:\\");
5173  for (i = 0; i < 26; absolute[0] = '\0', i++)
5174  {
5175  if (!(drives & (1 << i)))
5176  continue;
5177 
5178  absolute[0] = 'A' + i;
5179  if (GetDriveTypeA(absolute) != DRIVE_FIXED)
5180  continue;
5181 
5182  lstrcpynA(absolute + 3, relative, size + 1);
5183  attr = GetFileAttributesA(absolute);
5184  if (attr != INVALID_FILE_ATTRIBUTES &&
5186  {
5187  if (absolute[3 + size - 1] != '\\')
5188  lstrcatA(absolute, "\\");
5189  break;
5190  }
5191  absolute[3] = '\0';
5192  }
5193 }
UINT WINAPI GetDriveTypeA(IN LPCSTR lpRootPathName)
Definition: disk.c:468
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:636
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
Definition: cookie.c:201
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
__u8 attr
Definition: mkdosfs.c:359
#define DRIVE_FIXED
Definition: winbase.h:249
DWORD WINAPI GetLogicalDrives(VOID)
Definition: disk.c:110
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
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
#define lstrcpynA
Definition: compat.h:610

Referenced by test_appsearch_drlocator().

◆ set_component_path()

static void set_component_path ( LPCSTR  filename,
MSIINSTALLCONTEXT  context,
LPCSTR  guid,
LPSTR  usersid,
BOOL  dir 
)
static

Definition at line 263 of file package.c.

265 {
266  WCHAR guidW[MAX_PATH];
267  WCHAR squashedW[MAX_PATH];
268  CHAR squashed[MAX_PATH];
269  CHAR comppath[MAX_PATH + 81];
270  CHAR prodpath[MAX_PATH];
271  CHAR path[MAX_PATH];
272  LPCSTR prod = NULL;
273  HKEY hkey;
275 
276  if (is_wow64)
278 
279  MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
280  squash_guid(guidW, squashedW);
281  WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
282 
284  {
285  prod = "3D0DAE300FACA1300AD792060BCDAA92";
286  sprintf(comppath,
287  "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
288  "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed);
289  lstrcpyA(prodpath,
290  "SOFTWARE\\Classes\\Installer\\"
291  "Products\\3D0DAE300FACA1300AD792060BCDAA92");
292  }
294  {
295  prod = "7D2F387510109040002000060BECB6AB";
296  sprintf(comppath,
297  "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
298  "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
299  sprintf(prodpath,
300  "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
301  "Installer\\%s\\Installer\\Products\\"
302  "7D2F387510109040002000060BECB6AB", usersid);
303  }
305  {
306  prod = "7D2F387510109040002000060BECB6AB";
307  sprintf(comppath,
308  "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
309  "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
310  sprintf(prodpath,
311  "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
312  "Installer\\Managed\\%s\\Installer\\Products\\"
313  "7D2F387510109040002000060BECB6AB", usersid);
314  }
315 
316  RegCreateKeyExA(HKEY_LOCAL_MACHINE, comppath, 0, NULL, 0, access, NULL, &hkey, NULL);
317 
319  lstrcatA(path, "\\");
320  if (!dir) lstrcatA(path, filename);
321 
322  RegSetValueExA(hkey, prod, 0, REG_SZ, (LPBYTE)path, lstrlenA(path));
323  RegCloseKey(hkey);
324 
325  RegCreateKeyExA(HKEY_LOCAL_MACHINE, prodpath, 0, NULL, 0, access, NULL, &hkey, NULL);
326  RegCloseKey(hkey);
327 }
#define WideCharToMultiByte
Definition: compat.h:111
Definition: http.c:7251
#define CP_ACP
Definition: compat.h:109
char CHAR
Definition: xmlstorage.h:175
const char * filename
Definition: ioapi.h:135
static BOOL squash_guid(LPCWSTR in, LPWSTR out)
Definition: package.c:212
#define sprintf(buf, format,...)
Definition: sprintf.c:55
const GUID * guid
unsigned char * LPBYTE
Definition: typedefs.h:53
unsigned int dir
Definition: maze.c:112
const char * LPCSTR
Definition: xmlstorage.h:183
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
static char CURR_DIR[MAX_PATH]
Definition: package.c:39
static BOOL is_wow64
Definition: package.c:36
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
ACCESS_MASK REGSAM
Definition: winreg.h:69
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4816
LONG WINAPI RegCreateKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD Reserved, _In_ LPSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_ LPDWORD lpdwDisposition)
Definition: reg.c:1029
#define RegCloseKey(hKey)
Definition: registry.h:47
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22

Referenced by test_appsearch_complocator(), and test_complocator().

◆ set_suminfo_prop()

static void set_suminfo_prop ( MSIHANDLE  db,
DWORD  prop,
DWORD  val 
)
static

Definition at line 6147 of file package.c.

6148 {
6149  MSIHANDLE summary;
6150  UINT r;
6151 
6152  r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
6153  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6154 
6155  r = MsiSummaryInfoSetPropertyA(summary, prop, VT_I4, val, NULL, NULL);
6156  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6157 
6158  r = MsiSummaryInfoPersist(summary);
6159  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6160 
6161  MsiCloseHandle(summary);
6162 }
Definition: compat.h:2157
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
unsigned long MSIHANDLE
Definition: winemsi.idl:24
GLuint GLfloat * val
Definition: glext.h:7180
UINT WINAPI MsiSummaryInfoSetPropertyA(MSIHANDLE handle, UINT uiProperty, UINT uiDataType, INT iValue, FILETIME *pftValue, const char *szValue)
Definition: suminfo.c:937
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:269
UINT WINAPI MsiGetSummaryInformationA(MSIHANDLE hDatabase, const char *szDatabase, UINT uiUpdateCount, MSIHANDLE *pHandle)
Definition: suminfo.c:584
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
UINT WINAPI MsiSummaryInfoPersist(MSIHANDLE handle)
Definition: suminfo.c:1222

Referenced by test_MsiGetSourcePath(), and test_shortlongsource().

◆ set_summary_dword()

static void set_summary_dword ( MSIHANDLE  hdb,
DWORD  pid,
DWORD  value 
)
static

Definition at line 2545 of file package.c.

2546 {
2547  MSIHANDLE summary;
2548  UINT r;
2549 
2550  r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2551  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2552 
2554  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2555 
2556  r = MsiSummaryInfoPersist(summary);
2557  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2558 
2559  MsiCloseHandle(summary);
2560 }
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3835
Definition: pdh_main.c:93
Definition: compat.h:2157
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
unsigned long MSIHANDLE
Definition: winemsi.idl:24
UINT WINAPI MsiSummaryInfoSetPropertyA(MSIHANDLE handle, UINT uiProperty, UINT uiDataType, INT iValue, FILETIME *pftValue, const char *szValue)
Definition: suminfo.c:937
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:269
UINT WINAPI MsiGetSummaryInformationA(MSIHANDLE hDatabase, const char *szDatabase, UINT uiUpdateCount, MSIHANDLE *pHandle)
Definition: suminfo.c:584
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
UINT WINAPI MsiSummaryInfoPersist(MSIHANDLE handle)
Definition: suminfo.c:1222

Referenced by test_msipackage().

◆ set_summary_info()

static UINT set_summary_info ( MSIHANDLE  hdb)
static

Definition at line 876 of file package.c.

877 {
878  UINT res;
880 
881  /* build summary info */
883  ok( res == ERROR_SUCCESS , "Failed to open summaryinfo\n" );
884 
886  "Installation Database");
887  ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
888 
890  "Installation Database");
891  ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
892 
894  "Wine Hackers");
895  ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
896 
898  ";1033");
899  ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
900 
902  "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}");
903  ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
904 
906  ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
907 
909  ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
910 
912  ok( res == ERROR_SUCCESS , "Failed to make summary info persist\n" );
913 
915  ok( res == ERROR_SUCCESS , "Failed to close suminfo\n" );
916 
917  return res;
918 }
Definition: compat.h:2157
#define ERROR_SUCCESS
Definition: deptool.c:10
static const CHAR suminfo[]
Definition: db.c:2206
unsigned long MSIHANDLE
Definition: winemsi.idl:24
UINT WINAPI MsiSummaryInfoSetPropertyA(MSIHANDLE handle, UINT uiProperty, UINT uiDataType, INT iValue, FILETIME *pftValue, const char *szValue)
Definition: suminfo.c:937
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:269
UINT WINAPI MsiGetSummaryInformationA(MSIHANDLE hDatabase, const char *szDatabase, UINT uiUpdateCount, MSIHANDLE *pHandle)
Definition: suminfo.c:584
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
UINT WINAPI MsiSummaryInfoPersist(MSIHANDLE handle)
Definition: suminfo.c:1222
GLuint res
Definition: glext.h:9613

Referenced by create_package_db(), and test_MsiGetProductProperty().

◆ set_summary_str()

static void set_summary_str ( MSIHANDLE  hdb,
DWORD  pid,
LPCSTR  value 
)
static

Definition at line 2528 of file package.c.

2529 {
2530  MSIHANDLE summary;
2531  UINT r;
2532 
2533  r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2534  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2535 
2536  r = MsiSummaryInfoSetPropertyA(summary, pid, VT_LPSTR, 0, NULL, value);
2537  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2538 
2539  r = MsiSummaryInfoPersist(summary);
2540  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2541 
2542  MsiCloseHandle(summary);
2543 }
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3835
Definition: pdh_main.c:93
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
unsigned long MSIHANDLE
Definition: winemsi.idl:24
UINT WINAPI MsiSummaryInfoSetPropertyA(MSIHANDLE handle, UINT uiProperty, UINT uiDataType, INT iValue, FILETIME *pftValue, const char *szValue)
Definition: suminfo.c:937
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:269
UINT WINAPI MsiGetSummaryInformationA(MSIHANDLE hDatabase, const char *szDatabase, UINT uiUpdateCount, MSIHANDLE *pHandle)
Definition: suminfo.c:584
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
UINT WINAPI MsiSummaryInfoPersist(MSIHANDLE handle)
Definition: suminfo.c:1222

Referenced by test_msipackage(), and test_states().

◆ squash_guid()

static BOOL squash_guid ( LPCWSTR  in,
LPWSTR  out 
)
static

Definition at line 212 of file package.c.

213 {
214  DWORD i,n=1;
215  GUID guid;
216 
217  if (FAILED(CLSIDFromString((LPCOLESTR)in, &guid)))
218  return FALSE;
219 
220  for(i=0; i<8; i++)
221  out[7-i] = in[n++];
222  n++;
223  for(i=0; i<4; i++)
224  out[11-i] = in[n++];
225  n++;
226  for(i=0; i<4; i++)
227  out[15-i] = in[n++];
228  n++;
229  for(i=0; i<2; i++)
230  {
231  out[17+i*2] = in[n++];
232  out[16+i*2] = in[n++];
233  }
234  n++;
235  for( ; i<8; i++)
236  {
237  out[17+i*2] = in[n++];
238  out[16+i*2] = in[n++];
239  }
240  out[32]=0;
241  return TRUE;
242 }
#define TRUE
Definition: types.h:120
GLdouble n
Definition: glext.h:7729
const GUID * guid
#define FALSE
Definition: types.h:117
static FILE * out
Definition: regtests2xml.c:44
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint in
Definition: glext.h:9616
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
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2338

Referenced by create_test_guid(), delete_component_path(), set_component_path(), and test_MsiGetProductProperty().

◆ START_TEST()

START_TEST ( package  )

Definition at line 9623 of file package.c.

9624 {
9625  char temp_path[MAX_PATH], prev_path[MAX_PATH];
9627  BOOL ret = FALSE;
9628  DWORD len;
9629 
9631 
9632  if (pIsWow64Process)
9633  pIsWow64Process(GetCurrentProcess(), &is_wow64);
9634 
9635  GetCurrentDirectoryA(MAX_PATH, prev_path);
9638 
9640  len = lstrlenA(CURR_DIR);
9641 
9642  if (len && (CURR_DIR[len - 1] == '\\'))
9643  CURR_DIR[len - 1] = 0;
9644 
9645  /* Create a restore point ourselves so we circumvent the multitude of restore points
9646  * that would have been created by all the installation and removal tests.
9647  *
9648  * This is not needed on version 5.0 where setting MSIFASTINSTALL prevents the
9649  * creation of restore points.
9650  */
9651  if (pSRSetRestorePointA && !pMsiGetComponentPathExA)
9652  {
9653  memset(&status, 0, sizeof(status));
9655  }
9656 
9658  test_doaction();
9661  test_props();
9663  test_condition();
9664  test_msipackage();
9667  test_states();
9668  test_removefiles();
9669  test_appsearch();
9677  test_ccpsearch();
9678  test_complocator();
9681  test_sourcedir();
9682  test_access();
9688  test_costs();
9690  test_externalui();
9694 
9695  if (pSRSetRestorePointA && !pMsiGetComponentPathExA && ret)
9696  {
9698  if (ret)
9699  remove_restore_point(status.llSequenceNumber);
9700  }
9701 
9702  SetCurrentDirectoryA(prev_path);
9703 }
static void test_sourcedir(void)
Definition: package.c:7279
static void test_props(void)
Definition: package.c:2153
static void test_createpackage(void)
Definition: package.c:1086
static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
Definition: package.c:1060
static void test_featureparents(void)
Definition: package.c:5403
static void test_formatrecord_tables(void)
Definition: package.c:2747
static void test_appsearch_inilocator(void)
Definition: package.c:4958
static void test_appsearch_complocator(void)
Definition: package.c:4127
static void test_appsearch_reglocator(void)
Definition: package.c:4376
static void test_MsiDatabaseCommit(void)
Definition: package.c:8645
static void test_gettargetpath_bad(void)
Definition: package.c:1135
static void test_MsiApplyPatch(void)
Definition: package.c:8431
#define FALSE
Definition: types.h:117
#define END_NESTED_SYSTEM_CHANGE
unsigned int BOOL
Definition: ntddk_ex.h:94
static void remove_restore_point(DWORD seq_number)
Definition: package.c:1072
static void test_removefiles(void)
Definition: package.c:3861
static void test_MsiGetProductProperty(void)
Definition: package.c:7948
static void test_ccpsearch(void)
Definition: package.c:5860
#define BEGIN_NESTED_SYSTEM_CHANGE
static void test_installprops(void)
Definition: package.c:5573
static void test_costs(void)
Definition: package.c:8442
#define MAX_PATH
Definition: compat.h:34
static void test_MsiGetSourcePath(void)
Definition: package.c:6164
unsigned long DWORD
Definition: ntddk_ex.h:95
static void test_controlevent(void)
Definition: package.c:9304
static void test_doaction(void)
Definition: package.c:1105
static void test_condition(void)
Definition: package.c:1387
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
static void test_settargetpath(void)
Definition: package.c:1219
static void test_shortlongsource(void)
Definition: package.c:6945
static void test_externalui(void)
Definition: package.c:8714
int ret
static void test_appsearch_drlocator(void)
Definition: package.c:5195
BOOL WINAPI SetCurrentDirectoryA(IN LPCSTR lpPathName)
Definition: path.c:2206
static void test_MsiApplyMultiplePatches(void)
Definition: package.c:8387
GLenum GLsizei len
Definition: glext.h:6722
#define GetCurrentProcess()
Definition: compat.h:618
static void test_appsearch(void)
Definition: package.c:4010
static void test_top_level_action(void)
Definition: package.c:9532
static void test_complocator(void)
Definition: package.c:5906
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
static char CURR_DIR[MAX_PATH]
Definition: package.c:39
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2054
static void test_launchconditions(void)
Definition: package.c:5811
static BOOL is_wow64
Definition: package.c:36
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2146
static void test_emptypackage(void)
Definition: package.c:7783
static void test_access(void)
Definition: package.c:7749
static void test_formatrecord2(void)
Definition: package.c:2657
static void test_property_table(void)
Definition: package.c:2369
static void test_externalui_message(void)
Definition: package.c:9090
static void test_MsiSetProperty(void)
Definition: package.c:8272
static void test_msipackage(void)
Definition: package.c:2562
static void test_states(void)
Definition: package.c:3060
static STATEMGRSTATUS *static void init_functionpointers(void)
Definition: package.c:49
#define memset(x, y, z)
Definition: compat.h:39
static SERVICE_STATUS status
Definition: service.c:31
char temp_path[MAX_PATH]
Definition: mspatcha.c:123
Definition: ps.c:97

◆ test_access()

static void test_access ( void  )
static

Definition at line 7749 of file package.c.

7750 {
7751  MSIHANDLE hdb;
7752  UINT r;
7753 
7755  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7756 
7758 
7759  r = MsiDatabaseCommit(hdb);
7760  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7761 
7763  MsiCloseHandle(hdb);
7764 
7767 
7769  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7770 
7772 
7773  r = MsiDatabaseCommit(hdb);
7774  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7775 
7777  MsiCloseHandle(hdb);
7778 
7781 }
static const struct access_res create_close[16]
Definition: package.c:7684
#define ERROR_SUCCESS
Definition: deptool.c:10
static const struct access_res create_commit[16]
Definition: package.c:7664
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static const char msifile[]
Definition: package.c:37
#define test_file_access(file, ares)
Definition: package.c:7747
unsigned long MSIHANDLE
Definition: winemsi.idl:24
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define MSIDBOPEN_CREATE
Definition: msiquery.h:69
#define MSIDBOPEN_CREATEDIRECT
Definition: msiquery.h:70
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:269
static const WCHAR msifileW[]
Definition: package.c:38
UINT WINAPI MsiDatabaseCommit(MSIHANDLE hdb)
Definition: msiquery.c:963
#define ok(value,...)
Definition: atltest.h:57
UINT WINAPI MsiOpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIHANDLE *phDB)
Definition: database.c:298
unsigned int UINT
Definition: ndis.h:50
static const struct access_res create[16]
Definition: package.c:7644

Referenced by START_TEST().

◆ test_appsearch()

static void test_appsearch ( void  )
static

Definition at line 4010 of file package.c.

4011 {
4012  MSIHANDLE hpkg;
4013  UINT r;
4014  MSIHANDLE hdb;
4015  CHAR prop[MAX_PATH];
4016  DWORD size;
4017  HKEY hkey;
4018  const char reg_expand_value[] = "%systemroot%\\system32\\notepad.exe";
4019 
4020  hdb = create_package_db();
4021  ok ( hdb, "failed to create package database\n" );
4022 
4023  create_appsearch_table( hdb );
4024  add_appsearch_entry( hdb, "'WEBBROWSERPROG', 'NewSignature1'" );
4025  add_appsearch_entry( hdb, "'NOTEPAD', 'NewSignature2'" );
4026  add_appsearch_entry( hdb, "'REGEXPANDVAL', 'NewSignature3'" );
4027  add_appsearch_entry( hdb, "'32KEYVAL', 'NewSignature4'" );
4028  add_appsearch_entry( hdb, "'64KEYVAL', 'NewSignature5'" );
4029 
4030  create_reglocator_table( hdb );
4031  add_reglocator_entry( hdb, "NewSignature1", 0, "htmlfile\\shell\\open\\command", "", 1 );
4032 
4033  r = RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Winetest_msi", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hkey, NULL);
4034  ok( r == ERROR_SUCCESS, "Could not create key: %d.\n", r );
4035  r = RegSetValueExA(hkey, NULL, 0, REG_EXPAND_SZ, (const BYTE*)reg_expand_value, strlen(reg_expand_value) + 1);
4036  ok( r == ERROR_SUCCESS, "Could not set key value: %d.\n", r);
4037  RegCloseKey(hkey);
4038  add_reglocator_entry( hdb, "NewSignature3", 1, "Software\\Winetest_msi", "", msidbLocatorTypeFileName );
4039 
4040  r = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Winetest_msi", 0, NULL, 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY,
4041  NULL, &hkey, NULL);
4042  if (r == ERROR_ACCESS_DENIED)
4043  {
4044  skip("insufficient rights\n");
4045  RegDeleteKeyA(HKEY_CURRENT_USER, "Software\\Winetest_msi");
4046  MsiCloseHandle(hdb);
4048  return;
4049  }
4050  ok( r == ERROR_SUCCESS, "Could not create key: %d.\n", r );
4051 
4052  r = RegSetValueExA(hkey, NULL, 0, REG_SZ, (const BYTE *)"c:\\windows\\system32\\notepad.exe",
4053  sizeof("c:\\windows\\system32\\notepad.exe"));
4054  ok( r == ERROR_SUCCESS, "Could not set key value: %d.\n", r);
4055  RegCloseKey(hkey);
4056  add_reglocator_entry( hdb, "NewSignature4", 2, "Software\\Winetest_msi", "", msidbLocatorTypeFileName );
4057 
4058  r = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Winetest_msi", 0, NULL, 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY,
4059  NULL, &hkey, NULL);
4060  ok( r == ERROR_SUCCESS, "Could not create key: %d.\n", r );
4061  r = RegSetValueExA(hkey, NULL, 0, REG_SZ, (const BYTE *)"c:\\windows\\system32\\notepad.exe",
4062  sizeof("c:\\windows\\system32\\notepad.exe"));
4063  ok( r == ERROR_SUCCESS, "Could not set key value: %d.\n", r);
4064  RegCloseKey(hkey);
4065  add_reglocator_entry( hdb, "NewSignature5", 2, "Software\\Winetest_msi", "",
4067 
4068  create_drlocator_table( hdb );
4069  add_drlocator_entry( hdb, "'NewSignature2', 0, 'c:\\windows\\system32', 0" );
4070 
4071  create_signature_table( hdb );
4072  add_signature_entry( hdb, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
4073  add_signature_entry( hdb, "'NewSignature2', 'NOTEPAD.EXE|notepad.exe', '', '', '', '', '', '', ''" );
4074  add_signature_entry( hdb, "'NewSignature3', 'NOTEPAD.EXE|notepad.exe', '', '', '', '', '', '', ''" );
4075  add_signature_entry( hdb, "'NewSignature4', 'NOTEPAD.EXE|notepad.exe', '', '', '', '', '', '', ''" );
4076  add_signature_entry( hdb, "'NewSignature5', 'NOTEPAD.EXE|notepad.exe', '', '', '', '', '', '', ''" );
4077 
4078  r = package_from_db( hdb, &hpkg );
4080  {
4081  skip("Not enough rights to perform tests\n");
4083  return;
4084  }
4085  ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
4086  MsiCloseHandle( hdb );
4087  if (r != ERROR_SUCCESS)
4088  goto done;
4089 
4091 
4092  r = MsiDoActionA( hpkg, "AppSearch" );
4093  ok( r == ERROR_SUCCESS, "AppSearch failed: %d\n", r);
4094 
4095  size = sizeof(prop);
4096  r = MsiGetPropertyA( hpkg, "WEBBROWSERPROG", prop, &size );
4097  ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
4098  ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
4099 
4100  size = sizeof(prop);
4101  r = MsiGetPropertyA( hpkg, "NOTEPAD", prop, &size );
4102  ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
4103 
4104  size = sizeof(prop);
4105  r = MsiGetPropertyA( hpkg, "REGEXPANDVAL", prop, &size );
4106  ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
4107  ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
4108 
4109  size = sizeof(prop);
4110  r = MsiGetPropertyA( hpkg, "32KEYVAL", prop, &size );
4111  ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
4112  ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
4113 
4114  size = sizeof(prop);
4115  r = MsiGetPropertyA( hpkg, "64KEYVAL", prop, &size );
4116  ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
4117  ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
4118 
4119 done:
4120  MsiCloseHandle( hpkg );
4122  RegDeleteKeyA(HKEY_CURRENT_USER, "Software\\Winetest_msi");
4123  delete_key(HKEY_LOCAL_MACHINE, "Software\\Winetest_msi", KEY_WOW64_32KEY);
4124  delete_key(HKEY_LOCAL_MACHINE, "Software\\Winetest_msi", KEY_WOW64_64KEY);
4125 }
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define ERROR_SUCCESS
Definition: deptool.c:10
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define HKEY_CURRENT_USER
Definition: winreg.h:11
char CHAR
Definition: xmlstorage.h:175
static const char msifile[]
Definition: package.c:37
static UINT package_from_db(MSIHANDLE hdb, MSIHANDLE *handle)
Definition: package.c:951
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2284
#define add_signature_entry(hdb, values)
Definition: package.c:786
UINT WINAPI MsiGetPropertyA(MSIHANDLE hinst, const char *name, char *buf, DWORD *sz)
Definition: package.c:2313
static UINT create_drlocator_table(MSIHANDLE hdb)
Definition: package.c:609
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
unsigned long MSIHANDLE
Definition: winemsi.idl:24
static LONG delete_key(HKEY key, LPCSTR subkey, REGSAM access)
Definition: package.c:119
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
GLsizeiptr size
Definition: glext.h:5919
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
static UINT create_signature_table(MSIHANDLE hdb)
Definition: package.c:520
UINT WINAPI MsiDoActionA(MSIHANDLE hInstall, LPCSTR szAction)
Definition: install.c:45
#define add_appsearch_entry(hdb, values)
Definition: package.c:782
unsigned char BYTE
Definition: xxhash.c:193
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:269
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1222
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define skip(...)
Definition: atltest.h:64
static UINT add_reglocator_entry(MSIHANDLE hdb, const char *sig, UINT root, const char *path, const char *name, UINT type)
Definition: package.c:858
static UINT create_appsearch_table(MSIHANDLE hdb)
Definition: package.c:495
#define KEY_WOW64_32KEY
Definition: cmtypes.h:45
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4816
LONG WINAPI RegCreateKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD Reserved, _In_ LPSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_ LPDWORD lpdwDisposition)
Definition: reg.c:1029
static UINT create_reglocator_table(MSIHANDLE hdb)
Definition: package.c:506
#define add_drlocator_entry(hdb, values)
Definition: package.c:821
#define RegCloseKey(hKey)
Definition: registry.h:47
static MSIHANDLE create_package_db(void)
Definition: package.c:921
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22

Referenced by START_TEST().

◆ test_appsearch_complocator()

static void test_appsearch_complocator ( void  )
static

Definition at line 4127 of file package.c.

4128 {
4129  MSIHANDLE hpkg, hdb;
4130  char path[MAX_PATH + 15], expected[MAX_PATH], prop[MAX_PATH];
4131  LPSTR usersid;
4132  DWORD size;
4133  UINT r;
4134 
4135  if (!(usersid = get_user_sid()))
4136  return;
4137 
4138  if (is_process_limited())
4139  {
4140  skip("process is limited\n");
4141  return;
4142  }
4143 
4144  create_test_file("FileName1");
4145  create_test_file("FileName4");
4147  "{A8AE6692-96BA-4198-8399-145D7D1D0D0E}", NULL, FALSE);
4148 
4149  create_test_file("FileName2");
4151  "{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}", usersid, FALSE);
4152 
4153  create_test_file("FileName3");
4155  "{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}", usersid, FALSE);
4156 
4157  create_test_file("FileName5");
4159  "{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}", NULL, TRUE);
4160 
4161  create_test_file("FileName6");
4163  "{C0ECD96F-7898-4410-9667-194BD8C1B648}", NULL, TRUE);
4164 
4165  create_test_file("FileName7");
4167  "{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}", NULL, FALSE);
4168 
4169  /* dir is FALSE, but we're pretending it's a directory */
4171  "{91B7359B-07F2-4221-AA8D-DE102BB87A5F}", NULL, FALSE);
4172 
4173  create_file_with_version("FileName8.dll", MAKELONG(2, 1), MAKELONG(4, 3));
4175  "{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}", NULL, FALSE);
4176 
4177  create_file_with_version("FileName9.dll", MAKELONG(1, 2), MAKELONG(3, 4));
4179  "{A204DF48-7346-4635-BA2E-66247DBAC9DF}", NULL, FALSE);
4180 
4181  create_file_with_version("FileName10.dll", MAKELONG(2, 1), MAKELONG(4, 3));
4183  "{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}", NULL, FALSE);
4184 <