ReactOS  0.4.13-dev-563-g0561610
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 "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 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 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 HRESULT (WINAPI *pSHGetFolderPathA)(HWND
 
static BOOL (WINAPI *pCheckTokenMembership)(HANDLE
 
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY
 
static void (WINAPI *pGetSystemInfo)(LPSYSTEM_INFO)
 
static UINT (WINAPI *pGetSystemWow64DirectoryA)(LPSTR
 
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 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 BOOL check_prop_empty (MSIHANDLE hpkg, const char *prop)
 
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_getproperty (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_MsiEnumComponentCosts (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 []
 
static char CURR_DIR [MAX_PATH]
 
static LPCSTR
 
static MSIINSTALLCONTEXT
 
static LPSTR
 
static LPDWORD
 
static int
 
static HANDLE
 
static DWORD
 
static PSID
 
static PBOOL
 
static LPSTR *static PHANDLE
 
static REGSAM
 
static LPCWSTR
 
static UINT
 
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:754

Definition at line 853 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:754

Definition at line 791 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:754

Definition at line 821 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:754

Definition at line 828 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:754

Definition at line 768 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:754

Definition at line 845 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:754

Definition at line 849 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:754

Definition at line 837 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:754

Definition at line 841 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:754

Definition at line 773 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:754

Definition at line 824 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:754

Definition at line 782 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:754

Definition at line 777 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:754

Definition at line 786 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:754

Definition at line 832 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:754

Definition at line 808 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:754

Definition at line 812 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:754

Definition at line 801 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:754

Definition at line 816 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:754

Definition at line 805 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:754

Definition at line 795 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 8963 of file package.c.

◆ roundoffs

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

Definition at line 1008 of file package.c.

◆ roundpos

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

Definition at line 1009 of file package.c.

◆ test_file_access

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

Definition at line 7823 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 7780 of file package.c.

7781 {
7782  DWORD access = 0, share = 0;
7783  DWORD lasterr;
7784  HANDLE hfile;
7785  int i, j, idx = 0;
7786 
7787  for (i = 0; i < 4; i++)
7788  {
7789  if (i == 0) access = 0;
7790  if (i == 1) access = GENERIC_READ;
7791  if (i == 2) access = GENERIC_WRITE;
7792  if (i == 3) access = GENERIC_READ | GENERIC_WRITE;
7793 
7794  for (j = 0; j < 4; j++)
7795  {
7796  if (ares[idx].ignore)
7797  continue;
7798 
7799  if (j == 0) share = 0;
7800  if (j == 1) share = FILE_SHARE_READ;
7801  if (j == 2) share = FILE_SHARE_WRITE;
7802  if (j == 3) share = FILE_SHARE_READ | FILE_SHARE_WRITE;
7803 
7804  SetLastError(0xdeadbeef);
7805  hfile = CreateFileA(file, access, share, NULL, OPEN_EXISTING,
7807  lasterr = GetLastError();
7808 
7809  ok((hfile != INVALID_HANDLE_VALUE) == ares[idx].gothandle,
7810  "(%d, handle, %d): Expected %d, got %d\n",
7811  line, idx, ares[idx].gothandle,
7812  (hfile != INVALID_HANDLE_VALUE));
7813 
7814  ok(lasterr == ares[idx].lasterr, "(%d, lasterr, %d): Expected %d, got %d\n",
7815  line, idx, ares[idx].lasterr, lasterr);
7816 
7817  CloseHandle(hfile);
7818  idx++;
7819  }
7820  }
7821 }
#define CloseHandle
Definition: compat.h:398
int ignore(int trapCode, ppc_trap_frame_t *trap)
Definition: mmuobject.c:296
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_SHARE_READ
Definition: compat.h:125
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 GENERIC_WRITE
Definition: nt_native.h:90
#define ok(value,...)
unsigned int idx
Definition: utils.c:41
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
#define OPEN_EXISTING
Definition: compat.h:426
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:409
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define GENERIC_READ
Definition: compat.h:124
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399
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 754 of file package.c.

755 {
756  char *query;
757  UINT sz, r;
758 
759  sz = strlen(values) + strlen(insert) + 1;
760  query = HeapAlloc(GetProcessHeap(), 0, sz);
762  r = run_query(hdb, query);
764  ok_(file, line)(r == ERROR_SUCCESS, "failed to insert into %s table: %u\n", type, r);
765  return r;
766 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ok_(x1, x2)
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static int insert
Definition: xmllint.c:144
#define sprintf(buf, format,...)
Definition: sprintf.c:55
Definition: parser.c:48
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:430
unsigned int UINT
Definition: ndis.h:50
GLenum query
Definition: glext.h:7781
#define HeapFree(x, y, z)
Definition: compat.h:394
Definition: fci.c:126

◆ add_message()

static void add_message ( const struct externalui_message msg)
static

Definition at line 8865 of file package.c.

8866 {
8867  if (!sequence)
8868  {
8869  sequence_size = 10;
8871  }
8873  {
8874  sequence_size *= 2;
8876  }
8877 
8878  assert(sequence);
8879 
8880  sequence[sequence_count++] = *msg;
8881 }
static int sequence_size
Definition: package.c:8863
#define assert(x)
Definition: debug.h:53
static struct externalui_message * sequence
Definition: package.c:8862
static int sequence_count
Definition: package.c:8863
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define HeapReAlloc
Definition: compat.h:393
#define msg(x)
Definition: auth_time.c:54

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 857 of file package.c.

859 {
860  const char insert[] =
861  "INSERT INTO `RegLocator` (`Signature_`, `Root`, `Key`, `Name`, `Type`) "
862  "VALUES( '%s', %u, '%s', '%s', %u )";
863  char *query;
864  UINT sz, r;
865 
866  sz = strlen( sig ) + 10 + strlen( path ) + strlen( name ) + 10 + sizeof( insert );
867  query = HeapAlloc( GetProcessHeap(), 0, sz );
868  sprintf( query, insert, sig, root, path, name, type );
869  r = run_query( hdb, query );
870  HeapFree( GetProcessHeap(), 0, query );
871  ok(r == ERROR_SUCCESS, "failed to insert into reglocator table: %u\n", r); \
872  return r;
873 }
#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
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static int insert
Definition: xmllint.c:144
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define ok(value,...)
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:430
Definition: services.c:325
unsigned int UINT
Definition: ndis.h:50
Definition: name.c:36
GLenum query
Definition: glext.h:7781
#define HeapFree(x, y, z)
Definition: compat.h:394

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

◆ BOOL()

static BOOL ( WINAPI pCheckTokenMembership)
static

◆ check_prop_empty()

static BOOL check_prop_empty ( MSIHANDLE  hpkg,
const char prop 
)
static

Definition at line 2141 of file package.c.

2142 {
2143  UINT r;
2144  DWORD sz;
2145  char buffer[2];
2146 
2147  sz = sizeof buffer;
2148  strcpy(buffer,"x");
2149  r = MsiGetPropertyA( hpkg, prop, buffer, &sz );
2150  return r == ERROR_SUCCESS && buffer[0] == 0 && sz == 0;
2151 }
UINT WINAPI MsiGetPropertyA(MSIHANDLE hInstall, LPCSTR szName, LPSTR szValueBuf, LPDWORD pchValueBuf)
Definition: package.c:2488
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint buffer
Definition: glext.h:5915
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned int UINT
Definition: ndis.h:50
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388

Referenced by test_props().

◆ create_actiontext_table()

static UINT create_actiontext_table ( MSIHANDLE  hdb)
static

Definition at line 742 of file package.c.

743 {
744  UINT r = run_query(hdb,
745  "CREATE TABLE `ActionText` ("
746  "`Action` CHAR(72) NOT NULL, "
747  "`Description` CHAR(64) LOCALIZABLE, "
748  "`Template` CHAR(128) LOCALIZABLE "
749  "PRIMARY KEY `Action`)");
750  ok(r == ERROR_SUCCESS, "Failed to create ActionText table: %u\n", r);
751  return r;
752 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ok(value,...)
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:430
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 520 of file package.c.

521 {
522  UINT r = run_query( hdb,
523  "CREATE TABLE `AppSearch` ("
524  "`Property` CHAR(72) NOT NULL, "
525  "`Signature_` CHAR(72) NOT NULL "
526  "PRIMARY KEY `Property`, `Signature_`)" );
527  ok(r == ERROR_SUCCESS, "Failed to create AppSearch table: %u\n", r);
528  return r;
529 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ok(value,...)
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:430
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 624 of file package.c.

625 {
626  UINT r = run_query( hdb,
627  "CREATE TABLE `CCPSearch` ("
628  "`Signature_` CHAR(72) NOT NULL "
629  "PRIMARY KEY `Signature_`)" );
630  ok(r == ERROR_SUCCESS, "Failed to create CCPSearch table: %u\n", r);
631  return r;
632 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ok(value,...)
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:430
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 647 of file package.c.

648 {
649  UINT r = run_query( hdb,
650  "CREATE TABLE `CompLocator` ("
651  "`Signature_` CHAR(72) NOT NULL, "
652  "`ComponentId` CHAR(38) NOT NULL, "
653  "`Type` SHORT "
654  "PRIMARY KEY `Signature_`)" );
655  ok(r == ERROR_SUCCESS, "Failed to create CompLocator table: %u\n", r);
656  return r;
657 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ok(value,...)
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:430
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 446 of file package.c.

447 {
448  UINT r = run_query( hdb,
449  "CREATE TABLE `Component` ( "
450  "`Component` CHAR(72) NOT NULL, "
451  "`ComponentId` CHAR(38), "
452  "`Directory_` CHAR(72) NOT NULL, "
453  "`Attributes` SHORT NOT NULL, "
454  "`Condition` CHAR(255), "
455  "`KeyPath` CHAR(72) "
456  "PRIMARY KEY `Component`)" );
457  ok(r == ERROR_SUCCESS, "Failed to create Component table: %u\n", r);
458  return r;
459 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ok(value,...)
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:430
unsigned int UINT
Definition: ndis.h:50

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

◆ create_control_table()

static UINT create_control_table ( MSIHANDLE  hdb)
static

Definition at line 706 of file package.c.

707 {
708  UINT r = run_query(hdb,
709  "CREATE TABLE `Control` ("
710  "`Dialog_` CHAR(72) NOT NULL, "
711  "`Control` CHAR(50) NOT NULL, "
712  "`Type` CHAR(20) NOT NULL, "
713  "`X` SHORT NOT NULL, "
714  "`Y` SHORT NOT NULL, "
715  "`Width` SHORT NOT NULL, "
716  "`Height` SHORT NOT NULL, "
717  "`Attributes` LONG, "
718  "`Property` CHAR(50), "
719  "`Text` CHAR(0) LOCALIZABLE, "
720  "`Control_Next` CHAR(50), "
721  "`Help` CHAR(255) LOCALIZABLE "
722  "PRIMARY KEY `Dialog_`, `Control`)");
723  ok(r == ERROR_SUCCESS, "Failed to create Control table: %u\n", r);
724  return r;
725 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ok(value,...)
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:430
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 727 of file package.c.

728 {
729  UINT r = run_query(hdb,
730  "CREATE TABLE `ControlEvent` ("
731  "`Dialog_` CHAR(72) NOT NULL, "
732  "`Control_` CHAR(50) NOT NULL, "
733  "`Event` CHAR(50) NOT NULL, "
734  "`Argument` CHAR(255) NOT NULL, "
735  "`Condition` CHAR(255), "
736  "`Ordering` SHORT "
737  "PRIMARY KEY `Dialog_`, `Control_`, `Event`, `Argument`, `Condition`)");
738  ok(r == ERROR_SUCCESS, "Failed to create ControlEvent table: %u\n", r);
739  return r;
740 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ok(value,...)
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:430
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 674 of file package.c.

675 {
676  UINT r = run_query( hdb,
677  "CREATE TABLE `CustomAction` ("
678  "`Action` CHAR(72) NOT NULL, "
679  "`Type` SHORT NOT NULL, "
680  "`Source` CHAR(75), "
681  "`Target` CHAR(255) "
682  "PRIMARY KEY `Action`)" );
683  ok(r == ERROR_SUCCESS, "Failed to create CustomAction table: %u\n", r);
684  return r;
685 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ok(value,...)
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:430
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 687 of file package.c.

688 {
689  UINT r = run_query(hdb,
690  "CREATE TABLE `Dialog` ("
691  "`Dialog` CHAR(72) NOT NULL, "
692  "`HCentering` SHORT NOT NULL, "
693  "`VCentering` SHORT NOT NULL, "
694  "`Width` SHORT NOT NULL, "
695  "`Height` SHORT NOT NULL, "
696  "`Attributes` LONG, "
697  "`Title` CHAR(128) LOCALIZABLE, "
698  "`Control_First` CHAR(50) NOT NULL, "
699  "`Control_Default` CHAR(50), "
700  "`Control_Cancel` CHAR(50) "
701  "PRIMARY KEY `Dialog`)");
702  ok(r == ERROR_SUCCESS, "Failed to create Dialog table: %u\n", r);
703  return r;
704 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ok(value,...)
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:430
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 634 of file package.c.

635 {
636  UINT r = run_query( hdb,
637  "CREATE TABLE `DrLocator` ("
638  "`Signature_` CHAR(72) NOT NULL, "
639  "`Parent` CHAR(72), "
640  "`Path` CHAR(255), "
641  "`Depth` SHORT "
642  "PRIMARY KEY `Signature_`, `Parent`, `Path`)" );
643  ok(r == ERROR_SUCCESS, "Failed to create DrLocator table: %u\n", r);
644  return r;
645 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ok(value,...)
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:430
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 478 of file package.c.

479 {
480  UINT r = run_query( hdb,
481  "CREATE TABLE `FeatureComponents` ( "
482  "`Feature_` CHAR(38) NOT NULL, "
483  "`Component_` CHAR(72) NOT NULL "
484  "PRIMARY KEY `Feature_`, `Component_` )" );
485  ok(r == ERROR_SUCCESS, "Failed to create FeatureComponents table: %u\n", r);
486  return r;
487 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ok(value,...)
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:430
unsigned int UINT
Definition: ndis.h:50

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

◆ create_feature_table()

static UINT create_feature_table ( MSIHANDLE  hdb)
static

Definition at line 461 of file package.c.

462 {
463  UINT r = run_query( hdb,
464  "CREATE TABLE `Feature` ( "
465  "`Feature` CHAR(38) NOT NULL, "
466  "`Feature_Parent` CHAR(38), "
467  "`Title` CHAR(64), "
468  "`Description` CHAR(255), "
469  "`Display` SHORT NOT NULL, "
470  "`Level` SHORT NOT NULL, "
471  "`Directory_` CHAR(72), "
472  "`Attributes` SHORT NOT NULL "
473  "PRIMARY KEY `Feature`)" );
474  ok(r == ERROR_SUCCESS, "Failed to create Feature table: %u\n", r);
475  return r;
476 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ok(value,...)
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:430
unsigned int UINT
Definition: ndis.h:50

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

◆ create_file_data()

static void create_file_data ( LPCSTR  name,
LPCSTR  data 
)
static

Definition at line 975 of file package.c.

976 {
977  HANDLE file;
978  DWORD written;
979 
981  ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
982  if (file == INVALID_HANDLE_VALUE)
983  return;
984 
985  WriteFile(file, data, strlen(data), &written, NULL);
986  WriteFile(file, "\n", strlen("\n"), &written, NULL);
987 
988  CloseHandle(file);
989 }
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:398
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
#define GENERIC_WRITE
Definition: nt_native.h:90
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
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
Definition: name.c:36
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399
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 489 of file package.c.

490 {
491  UINT r = run_query( hdb,
492  "CREATE TABLE `File` ("
493  "`File` CHAR(72) NOT NULL, "
494  "`Component_` CHAR(72) NOT NULL, "
495  "`FileName` CHAR(255) NOT NULL, "
496  "`FileSize` LONG NOT NULL, "
497  "`Version` CHAR(72), "
498  "`Language` CHAR(20), "
499  "`Attributes` SHORT, "
500  "`Sequence` SHORT NOT NULL "
501  "PRIMARY KEY `File`)" );
502  ok(r == ERROR_SUCCESS, "Failed to create File table: %u\n", r);
503  return r;
504 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ok(value,...)
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:430
unsigned int UINT
Definition: ndis.h:50

Referenced by test_featureparents(), test_formatrecord_tables(), test_MsiEnumComponentCosts(), 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 1011 of file package.c.

1012 {
1013  VS_VERSIONINFO *pVerInfo;
1014  VS_FIXEDFILEINFO *pFixedInfo;
1015  LPBYTE buffer, ofs;
1016  CHAR path[MAX_PATH];
1017  DWORD handle, size;
1018  HANDLE resource;
1019  BOOL ret = FALSE;
1020 
1022  /* Some dlls can't be updated on Vista/W2K8 */
1023  lstrcatA(path, "\\version.dll");
1024 
1025  CopyFileA(path, name, FALSE);
1026 
1029 
1031 
1032  pVerInfo = (VS_VERSIONINFO *)buffer;
1033  ofs = (BYTE *)&pVerInfo->szKey[lstrlenW(pVerInfo->szKey) + 1];
1034  pFixedInfo = (VS_FIXEDFILEINFO *)roundpos(pVerInfo, ofs, 4);
1035 
1036  pFixedInfo->dwFileVersionMS = ms;
1037  pFixedInfo->dwFileVersionLS = ls;
1038  pFixedInfo->dwProductVersionMS = ms;
1039  pFixedInfo->dwProductVersionLS = ls;
1040 
1042  if (!resource)
1043  goto done;
1044 
1047  goto done;
1048 
1050  goto done;
1051 
1052  ret = TRUE;
1053 
1054 done:
1056  return ret;
1057 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define TRUE
Definition: types.h:120
BOOL WINAPI UpdateResourceA(HANDLE hUpdate, LPCSTR lpType, LPCSTR lpName, WORD wLanguage, LPVOID lpData, DWORD cbData)
Definition: res.c:1738
#define LANG_NEUTRAL
Definition: nls.h:22
char CHAR
Definition: xmlstorage.h:175
DWORD dwFileVersionLS
Definition: compat.h:552
UINT WINAPI GetSystemDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2282
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:407
void ls(int argc, const char *argv[])
Definition: cmds.c:1136
unsigned char * LPBYTE
Definition: typedefs.h:52
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
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
DWORD WINAPI GetFileVersionInfoSizeA(LPCSTR filename, LPDWORD handle)
Definition: version.c:624
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD dwFileVersionMS
Definition: compat.h:551
BOOL WINAPI GetFileVersionInfoA(LPCSTR filename, DWORD handle, DWORD datasize, LPVOID data)
Definition: version.c:858
int ret
#define roundpos(a, b, r)
Definition: package.c:1009
unsigned char BYTE
Definition: mem.h:68
Definition: services.c:325
DWORD dwProductVersionLS
Definition: compat.h:554
#define VS_VERSION_INFO
HANDLE WINAPI BeginUpdateResourceA(LPCSTR pFileName, BOOL bDeleteExistingResources)
Definition: res.c:1657
Definition: name.c:36
#define MAKELANGID(p, s)
Definition: nls.h:15
DWORD dwProductVersionMS
Definition: compat.h:553
#define HeapFree(x, y, z)
Definition: compat.h:394
WCHAR szKey[17]
Definition: fusionpriv.h:379
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 659 of file package.c.

660 {
661  UINT r = run_query( hdb,
662  "CREATE TABLE `IniLocator` ("
663  "`Signature_` CHAR(72) NOT NULL, "
664  "`FileName` CHAR(255) NOT NULL, "
665  "`Section` CHAR(96)NOT NULL, "
666  "`Key` CHAR(128)NOT NULL, "
667  "`Field` SHORT, "
668  "`Type` SHORT "
669  "PRIMARY KEY `Signature_`)" );
670  ok(r == ERROR_SUCCESS, "Failed to create IniLocator table: %u\n", r);
671  return r;
672 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ok(value,...)
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:430
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 585 of file package.c.

586 {
587  UINT r = run_query( hdb,
588  "CREATE TABLE `InstallExecuteSequence` ("
589  "`Action` CHAR(72) NOT NULL, "
590  "`Condition` CHAR(255), "
591  "`Sequence` SHORT "
592  "PRIMARY KEY `Action`)" );
593  ok(r == ERROR_SUCCESS, "Failed to create InstallExecuteSequence table: %u\n", r);
594  return r;
595 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ok(value,...)
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:430
unsigned int UINT
Definition: ndis.h:50

Referenced by test_MsiEnumComponentCosts(), 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 597 of file package.c.

598 {
599  UINT r = run_query( hdb,
600  "CREATE TABLE `InstallUISequence` ("
601  "`Action` CHAR(72) NOT NULL, "
602  "`Condition` CHAR(255), "
603  "`Sequence` SHORT "
604  "PRIMARY KEY `Action`)" );
605  ok(r == ERROR_SUCCESS, "Failed to create InstallUISequence table: %u\n", r);
606  return r;
607 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ok(value,...)
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:430
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 563 of file package.c.

564 {
565  UINT r = run_query( hdb,
566  "CREATE TABLE `LaunchCondition` ("
567  "`Condition` CHAR(255) NOT NULL, "
568  "`Description` CHAR(255) NOT NULL "
569  "PRIMARY KEY `Condition`)" );
570  ok(r == ERROR_SUCCESS, "Failed to create LaunchCondition table: %u\n", r);
571  return r;
572 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ok(value,...)
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:430
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 609 of file package.c.

610 {
611  UINT r = run_query( hdb,
612  "CREATE TABLE `Media` ("
613  "`DiskId` SHORT NOT NULL, "
614  "`LastSequence` SHORT NOT NULL, "
615  "`DiskPrompt` CHAR(64), "
616  "`Cabinet` CHAR(255), "
617  "`VolumeLabel` CHAR(32), "
618  "`Source` CHAR(72) "
619  "PRIMARY KEY `DiskId`)" );
620  ok(r == ERROR_SUCCESS, "Failed to create Media table: %u\n", r);
621  return r;
622 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ok(value,...)
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:430
unsigned int UINT
Definition: ndis.h:50

Referenced by test_MsiEnumComponentCosts(), and test_states().

◆ create_package_db()

static MSIHANDLE create_package_db ( void  )
static

Definition at line 920 of file package.c.

921 {
922  MSIHANDLE hdb = 0;
923  UINT res;
924 
926 
927  /* create an empty database */
929  ok( res == ERROR_SUCCESS , "Failed to create database %u\n", res );
930  if( res != ERROR_SUCCESS )
931  return hdb;
932 
933  res = MsiDatabaseCommit( hdb );
934  ok( res == ERROR_SUCCESS , "Failed to commit database\n" );
935 
936  res = set_summary_info(hdb);
937  ok( res == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", res);
938 
939  res = run_query( hdb,
940  "CREATE TABLE `Directory` ( "
941  "`Directory` CHAR(255) NOT NULL, "
942  "`Directory_Parent` CHAR(255), "
943  "`DefaultDir` CHAR(255) NOT NULL "
944  "PRIMARY KEY `Directory`)" );
945  ok( res == ERROR_SUCCESS , "Failed to create directory table\n" );
946 
947  return hdb;
948 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static const char msifile[]
Definition: package.c:36
unsigned long MSIHANDLE
Definition: msiserver.idl:25
#define ok(value,...)
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:430
static const WCHAR msifileW[]
Definition: package.c:37
UINT WINAPI MsiDatabaseCommit(MSIHANDLE hdb)
Definition: msiquery.c:813
static UINT set_summary_info(MSIHANDLE hdb)
Definition: package.c:875
UINT WINAPI MsiOpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIHANDLE *phDB)
Definition: database.c:303
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_getproperty(), test_gettargetpath_bad(), test_installprops(), test_launchconditions(), test_MsiDatabaseCommit(), test_MsiEnumComponentCosts(), 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 574 of file package.c.

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

Referenced by test_MsiDatabaseCommit(), test_MsiEnumComponentCosts(), 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 531 of file package.c.

532 {
533  UINT r = run_query( hdb,
534  "CREATE TABLE `RegLocator` ("
535  "`Signature_` CHAR(72) NOT NULL, "
536  "`Root` SHORT NOT NULL, "
537  "`Key` CHAR(255) NOT NULL, "
538  "`Name` CHAR(255), "
539  "`Type` SHORT "
540  "PRIMARY KEY `Signature_`)" );
541  ok(r == ERROR_SUCCESS, "Failed to create RegLocator table: %u\n", r);
542  return r;
543 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ok(value,...)
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:430
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 506 of file package.c.

507 {
508  UINT r = run_query( hdb,
509  "CREATE TABLE `RemoveFile` ("
510  "`FileKey` CHAR(72) NOT NULL, "
511  "`Component_` CHAR(72) NOT NULL, "
512  "`FileName` CHAR(255) LOCALIZABLE, "
513  "`DirProperty` CHAR(72) NOT NULL, "
514  "`InstallMode` SHORT NOT NULL "
515  "PRIMARY KEY `FileKey`)" );
516  ok(r == ERROR_SUCCESS, "Failed to create RemoveFile table: %u\n", r);
517  return r;
518 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ok(value,...)
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:430
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 545 of file package.c.

546 {
547  UINT r = run_query( hdb,
548  "CREATE TABLE `Signature` ("
549  "`Signature` CHAR(72) NOT NULL, "
550  "`FileName` CHAR(255) NOT NULL, "
551  "`MinVersion` CHAR(20), "
552  "`MaxVersion` CHAR(20), "
553  "`MinSize` LONG, "
554  "`MaxSize` LONG, "
555  "`MinDate` LONG, "
556  "`MaxDate` LONG, "
557  "`Languages` CHAR(255) "
558  "PRIMARY KEY `Signature`)" );
559  ok(r == ERROR_SUCCESS, "Failed to create Signature table: %u\n", r);
560  return r;
561 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ok(value,...)
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: package.c:430
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 991 of file package.c.

992 {
994 }
static void create_file_data(LPCSTR name, LPCSTR data)
Definition: package.c:975
Definition: name.c:36

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 269 of file package.c.

270 {
271  WCHAR guidW[MAX_PATH];
272  WCHAR squashedW[MAX_PATH];
273  GUID guid;
274  HRESULT hr;
275  int size;
276 
277  hr = CoCreateGuid(&guid);
278  ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
279 
280  size = StringFromGUID2(&guid, guidW, MAX_PATH);
281  ok(size == 39, "Expected 39, got %d\n", hr);
282 
283  WideCharToMultiByte(CP_ACP, 0, guidW, size, prodcode, MAX_PATH, NULL, NULL);
284  squash_guid(guidW, squashedW);
285  WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
286 }
#define WideCharToMultiByte
Definition: compat.h:101
HRESULT hr
Definition: shlfolder.c:183
#define CP_ACP
Definition: compat.h:99
static BOOL squash_guid(LPCWSTR in, LPWSTR out)
Definition: package.c:237
const GUID * guid
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2343
HRESULT WINAPI CoCreateGuid(GUID *pguid)
Definition: compobj.c:2115
#define S_OK
Definition: intsafe.h:59

Referenced by test_MsiGetProductProperty().

◆ delete_component_path()

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

Definition at line 354 of file package.c.

355 {
356  WCHAR guidW[MAX_PATH];
357  WCHAR squashedW[MAX_PATH];
359  CHAR squashed[MAX_PATH];
360  CHAR comppath[MAX_PATH];
361  CHAR prodpath[MAX_PATH];
363 
364  if (is_wow64)
366 
367  MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
368  squash_guid(guidW, squashedW);
369  WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
370 
372  {
373  sprintf(comppath,
374  "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
375  "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed);
376  lstrcpyA(prodpath,
377  "SOFTWARE\\Classes\\Installer\\"
378  "Products\\3D0DAE300FACA1300AD792060BCDAA92");
379  }
381  {
382  sprintf(comppath,
383  "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
384  "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
385  sprintf(prodpath,
386  "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
387  "Installer\\%s\\Installer\\Products\\"
388  "7D2F387510109040002000060BECB6AB", usersid);
389  }
391  {
392  sprintf(comppath,
393  "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
394  "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
395  sprintf(prodpath,
396  "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
397  "Installer\\Managed\\%s\\Installer\\Products\\"
398  "7D2F387510109040002000060BECB6AB", usersid);
399  }
400 
401  MultiByteToWideChar(CP_ACP, 0, comppath, -1, substrW, MAX_PATH);
403 
404  MultiByteToWideChar(CP_ACP, 0, prodpath, -1, substrW, MAX_PATH);
406 }
#define WideCharToMultiByte
Definition: compat.h:101
Definition: http.c:6587
#define CP_ACP
Definition: compat.h:99
char CHAR
Definition: xmlstorage.h:175
static BOOL squash_guid(LPCWSTR in, LPWSTR out)
Definition: package.c:237
#define sprintf(buf, format,...)
Definition: sprintf.c:55
const GUID * guid
smooth NULL
Definition: ftsmooth.c:416
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
static LSTATUS package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey, REGSAM access)
Definition: package.c:169
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:35
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 MultiByteToWideChar
Definition: compat.h:100
#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 137 of file package.c.

138 {
139  if (pRegDeleteKeyExA)
140  return pRegDeleteKeyExA( key, subkey, access, 0 );
141  return RegDeleteKeyA( key, subkey );
142 }
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1222
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
Definition: path.c:42

Referenced by test_MsiGetProductProperty().

◆ delete_win_ini()

static void delete_win_ini ( LPCSTR  file)
static

Definition at line 4875 of file package.c.

4876 {
4877  CHAR path[MAX_PATH];
4878 
4880  lstrcatA(path, "\\");
4881  lstrcatA(path, file);
4882 
4883  DeleteFileA(path);
4884 }
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:26
Definition: services.c:325
UINT WINAPI GetWindowsDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2336
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 408 of file package.c.

409 {
410  MSIHANDLE hview = 0;
411  UINT r, ret;
412 
413  /* open a select query */
414  r = MsiDatabaseOpenViewA(hdb, query, &hview);
415  if (r != ERROR_SUCCESS)
416  return r;
417  r = MsiViewExecute(hview, 0);
418  if (r != ERROR_SUCCESS)
419  return r;
420  ret = MsiViewFetch(hview, phrec);
421  r = MsiViewClose(hview);
422  if (r != ERROR_SUCCESS)
423  return r;
424  r = MsiCloseHandle(hview);
425  if (r != ERROR_SUCCESS)
426  return r;
427  return ret;
428 }
UINT WINAPI MsiViewExecute(MSIHANDLE hView, MSIHANDLE hRec)
Definition: msiquery.c:459
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
UINT WINAPI MsiDatabaseOpenViewA(MSIHANDLE hdb, LPCSTR szQuery, MSIHANDLE *phView)
Definition: msiquery.c:88
unsigned long MSIHANDLE
Definition: msiserver.idl:25
UINT WINAPI MsiViewClose(MSIHANDLE hView)
Definition: msiquery.c:427
UINT WINAPI MsiViewFetch(MSIHANDLE hView, MSIHANDLE *record)
Definition: msiquery.c:385
int ret
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
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 8759 of file package.c.

8760 {
8761  externalui_ran = 1;
8762  ok(message_type == INSTALLMESSAGE_USER, "expected INSTALLMESSAGE_USER, got %08x\n", message_type);
8763  return 0;
8764 }
#define ok(value,...)
static int externalui_ran
Definition: package.c:8757

Referenced by test_externalui().

◆ externalui_message_callback()

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

Definition at line 9123 of file package.c.

9124 {
9125  INT retval = context ? *((INT *)context) : 0;
9126  struct externalui_message msg;
9127  char buffer[256];
9128  DWORD length;
9129  UINT r;
9130  int i;
9131 
9132  msg.message = message;
9134  {
9135  /* trying to access the record seems to hang on some versions of Windows */
9136  msg.field_count = -1;
9137  add_message(&msg);
9138  return 1;
9139  }
9140  msg.field_count = MsiRecordGetFieldCount(hrecord);
9141  for (i = 0; i <= msg.field_count; i++)
9142  {
9143  length = sizeof(buffer);
9144  r = MsiRecordGetStringA(hrecord, i, buffer, &length);
9145  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
9146  memcpy(msg.field[i], buffer, min(100, length+1));
9147  }
9148 
9149  /* top-level actions dump a list of all set properties; skip them since they're inconsistent */
9150  if (message == (INSTALLMESSAGE_INFO|MB_ICONHAND) && msg.field_count > 0 && !strncmp(msg.field[0], "Property", 8))
9151  return retval;
9152 
9153  add_message(&msg);
9154 
9155  return retval;
9156 }
#define MB_ICONHAND
Definition: winuser.h:782
Definition: tftpd.h:59
#define ERROR_SUCCESS
Definition: deptool.c:10
Definition: http.c:6587
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:8865
GLuint buffer
Definition: glext.h:5915
UINT WINAPI MsiRecordGetStringA(MSIHANDLE handle, UINT iField, LPSTR szValue, LPDWORD pcchValue)
Definition: record.c:451
int32_t INT
Definition: typedefs.h:56
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,...)
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
#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:116

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 9110 of file package.c.

9111 {
9112  INT retval = context ? *((INT *)context) : 0;
9113  struct externalui_message msg;
9114 
9115  msg.message = message;
9116  msg.field_count = 0;
9117  strcpy(msg.field[0], string);
9118  add_message(&msg);
9119 
9120  return retval;
9121 }
Definition: http.c:6587
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: glext.h:5579
static void add_message(const struct externalui_message *msg)
Definition: package.c:8865
int32_t INT
Definition: typedefs.h:56
#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 8768 of file package.c.

8769 {
8770  INT retval = context ? *((INT *)context) : 0;
8771  UINT r;
8773  ok(message_type == INSTALLMESSAGE_USER, "expected INSTALLMESSAGE_USER, got %08x\n", message_type);
8774  r = MsiRecordGetFieldCount(hrecord);
8775  ok(r == 1, "expected 1, got %u\n", r);
8776  r = MsiRecordGetInteger(hrecord, 1);
8777  ok(r == 12345, "expected 12345, got %u\n", r);
8778  return retval;
8779 }
Definition: http.c:6587
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
int WINAPI MsiRecordGetInteger(MSIHANDLE handle, UINT iField)
Definition: record.c:271
int32_t INT
Definition: typedefs.h:56
#define ok(value,...)
unsigned int UINT
Definition: ndis.h:50
UINT WINAPI MsiRecordGetFieldCount(MSIHANDLE handle)
Definition: record.c:116
static int externalui_record_ran
Definition: package.c:8766

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 2325 of file package.c.

2326 {
2327  MSIHANDLE hview, hrec;
2328  BOOL found = FALSE;
2329  CHAR buffer[MAX_PATH];
2330  DWORD sz;
2331  UINT r;
2332 
2333  r = MsiDatabaseOpenViewA(hdb, "SELECT * FROM `_Property`", &hview);
2334  ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
2335  r = MsiViewExecute(hview, 0);
2336  ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n");
2337 
2338  if (len < 0) len = lstrlenA(val);
2339 
2340  while (r == ERROR_SUCCESS && !found)
2341  {
2342  r = MsiViewFetch(hview, &hrec);
2343  if (r != ERROR_SUCCESS) break;
2344 
2345  sz = MAX_PATH;
2346  r = MsiRecordGetStringA(hrec, 1, buffer, &sz);
2347  if (r == ERROR_SUCCESS && !lstrcmpA(buffer, prop))
2348  {
2349  sz = MAX_PATH;
2350  r = MsiRecordGetStringA(hrec, 2, buffer, &sz);
2351  if (r == ERROR_SUCCESS && !memcmp(buffer, val, len) && !buffer[len])
2352  {
2353  ok(sz == len, "wrong size %u\n", sz);
2354  found = TRUE;
2355  }
2356  }
2357 
2358  MsiCloseHandle(hrec);
2359  }
2360  MsiViewClose(hview);
2361  MsiCloseHandle(hview);
2362  return found;
2363 }
UINT WINAPI MsiViewExecute(MSIHANDLE hView, MSIHANDLE hRec)
Definition: msiquery.c:459
#define TRUE
Definition: types.h:120
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define ERROR_SUCCESS
Definition: deptool.c:10
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 MsiRecordGetStringA(MSIHANDLE handle, UINT iField, LPSTR szValue, LPDWORD pcchValue)
Definition: record.c:451
UINT WINAPI MsiDatabaseOpenViewA(MSIHANDLE hdb, LPCSTR szQuery, MSIHANDLE *phView)
Definition: msiquery.c:88
unsigned long MSIHANDLE
Definition: msiserver.idl:25
UINT WINAPI MsiViewClose(MSIHANDLE hView)
Definition: msiquery.c:427
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok(value,...)
GLuint GLfloat * val
Definition: glext.h:7180
UINT WINAPI MsiViewFetch(MSIHANDLE hView, MSIHANDLE *record)
Definition: msiquery.c:385
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
unsigned int UINT
Definition: ndis.h:50

Referenced by test_property_table().

◆ flush_sequence()

static void flush_sequence ( void  )
static

Definition at line 8883 of file package.c.

8884 {
8886  sequence = NULL;
8888 }
static int sequence_size
Definition: package.c:8863
static struct externalui_message * sequence
Definition: package.c:8862
smooth NULL
Definition: ftsmooth.c:416
static int sequence_count
Definition: package.c:8863
#define GetProcessHeap()
Definition: compat.h:395
#define HeapFree(x, y, z)
Definition: compat.h:394

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 144 of file package.c.

145 {
146  HANDLE token;
147  DWORD size = 0;
148  TOKEN_USER *user;
149  char *usersid = NULL;
150 
151  if (!pConvertSidToStringSidA)
152  {
153  win_skip("ConvertSidToStringSidA is not available\n");
154  return NULL;
155  }
158 
161  pConvertSidToStringSidA(user->User.Sid, &usersid);
163 
165  return usersid;
166 }
#define CloseHandle
Definition: compat.h:398
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
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define TOKEN_QUERY
Definition: setypes.h:874
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1168
unsigned long DWORD
Definition: ntddk_ex.h:95
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 win_skip
Definition: test.h:141
void user(int argc, const char *argv[])
Definition: cmds.c:1350
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by test_appsearch_complocator().

◆ HRESULT()

static HRESULT ( WINAPI pSHGetFolderPathA)
static

◆ init_functionpointers()

static STATEMGRSTATUS* static void init_functionpointers ( void  )
static

Definition at line 57 of file package.c.

58 {
59  HMODULE hmsi = GetModuleHandleA("msi.dll");
60  HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
61  HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
62  HMODULE hshell32 = GetModuleHandleA("shell32.dll");
64 
65 #define GET_PROC(mod, func) \
66  p ## func = (void*)GetProcAddress(mod, #func);
67 
69  GET_PROC(hshell32, SHGetFolderPathA);
70 
71  GET_PROC(hadvapi32, CheckTokenMembership);
72  GET_PROC(hadvapi32, ConvertSidToStringSidA);
73  GET_PROC(hadvapi32, OpenProcessToken);
74  GET_PROC(hadvapi32, RegDeleteKeyExA)
75  GET_PROC(hadvapi32, RegDeleteKeyExW)
80 
81  hsrclient = LoadLibraryA("srclient.dll");
84 #undef GET_PROC
85 }
INSTALLSTATE WINAPI MsiGetComponentPathExA(LPCSTR product, LPCSTR comp, LPCSTR usersid, MSIINSTALLCONTEXT ctx, LPSTR buf, LPDWORD buflen)
Definition: msi.c:2916
LONG WINAPI RegDeleteKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ REGSAM samDesired, _In_ DWORD Reserved)
Definition: reg.c:1252
VOID WINAPI GetNativeSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
Definition: sysinfo.c:206
static HINSTANCE hkernel32
Definition: process.c:66
BOOL WINAPI CheckTokenMembership(IN HANDLE ExistingTokenHandle, IN PSID SidToCheck, OUT PBOOL IsMember)
Definition: token.c:21
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
UINT WINAPI GetSystemWow64DirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2437
BOOL WINAPI IsWow64Process(IN HANDLE hProcess, OUT PBOOL Wow64Process)
Definition: proc.c:2004
#define GET_PROC(mod, func)
static HMODULE hsrclient
Definition: action.c:55
BOOL WINAPI ConvertSidToStringSidA(PSID Sid, LPSTR *StringSid)
Definition: security.c:3313
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
HRESULT WINAPI SHGetFolderPathA(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPSTR pszPath)
Definition: shellpath.c:2326
BOOL WINAPI SRSetRestorePointA(PRESTOREPOINTINFOA pRestorePtSpec, PSTATEMGRSTATUS pSMgrStatus)
Definition: sfc.c:54
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
Definition: sysinfo.c:142
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296

Referenced by START_TEST().

◆ INSTALLSTATE()

static INSTALLSTATE ( WINAPI pMsiGetComponentPathExA)
static

◆ is_process_limited()

static BOOL is_process_limited ( void  )
static

Definition at line 87 of file package.c.

88 {
90  PSID Group = NULL;
91  BOOL IsInGroup;
92  HANDLE token;
93 
94  if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE;
95 
97  DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
98  !pCheckTokenMembership(NULL, Group, &IsInGroup))
99  {
100  trace("Could not check if the current user is an administrator\n");
101  FreeSid(Group);
102  return FALSE;
103  }
104  FreeSid(Group);
105 
106  if (!IsInGroup)
107  {
111  0, 0, 0, 0, 0, 0, &Group) ||
112  !pCheckTokenMembership(NULL, Group, &IsInGroup))
113  {
114  trace("Could not check if the current user is a power user\n");
115  return FALSE;
116  }
117  if (!IsInGroup)
118  {
119  /* Only administrators and power users can be powerful */
120  return TRUE;
121  }
122  }
123 
124  if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
125  {
126  BOOL ret;
128  DWORD size;
129 
132  return (ret && type == TokenElevationTypeLimited);
133  }
134  return FALSE;
135 }
#define trace(...)
Definition: kmt_test.h:217
enum _TOKEN_ELEVATION_TYPE TOKEN_ELEVATION_TYPE
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
_In_opt_ PSID Group
Definition: rtlfuncs.h:1606
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define DOMAIN_ALIAS_RID_POWER_USERS
Definition: setypes.h:627
unsigned int BOOL
Definition: ntddk_ex.h:94
PVOID WINAPI FreeSid(PSID pSid)
Definition: security.c:577
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
smooth NULL
Definition: ftsmooth.c:416
#define SECURITY_NT_AUTHORITY
Definition: setypes.h:526
GLsizeiptr size
Definition: glext.h:5919
#define SECURITY_BUILTIN_DOMAIN_RID
Definition: setypes.h:553
#define TOKEN_QUERY
Definition: setypes.h:874
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1168
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:413
#define DOMAIN_ALIAS_RID_ADMINS
Definition: setypes.h:624
SID_IDENTIFIER_AUTHORITY NtAuthority
Definition: database.c:19
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:553

Referenced by test_appsearch_complocator(), and test_states().

◆ is_root()

static BOOL is_root ( const char path)
static

Definition at line 1080 of file package.c.

1081 {
1082  return (isalpha(path[0]) && path[1] == ':' && path[2] == '\\' && !path[3]);
1083 }
#define isalpha(c)
Definition: acclib.h:74
Definition: services.c:325

Referenced by test_appsearch_complocator(), test_appsearch_drlocator(), test_appsearch_inilocator(), test_appsearch_reglocator(), test_complocator(), test_installprops(), test_MsiGetSourcePath(), test_shortlongsource(), and test_sourcedir().

◆ LONG()

static LONG ( WINAPI pRegDeleteKeyExA)
static

◆ notify_system_change()

static BOOL notify_system_change ( DWORD  event_type,
STATEMGRSTATUS status 
)
static

Definition at line 1059 of file package.c.

1060 {
1061  RESTOREPOINTINFOA spec;
1062 
1063  spec.dwEventType = event_type;
1065  spec.llSequenceNumber = status->llSequenceNumber;
1066  lstrcpyA(spec.szDescription, "msitest restore point");
1067 
1068  return pSRSetRestorePointA(&spec, status);
1069 }
#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 8890 of file package.c.

8892 {
8893  static const struct externalui_message end_of_sequence = {0};
8894  const struct externalui_message *actual;
8895  int failcount = 0;
8896  int i;
8897 
8898  add_message(&end_of_sequence);
8899 
8900  actual = sequence;
8901 
8902  while (expected->message && actual->message)
8903  {
8904  if (expected->message == actual->message)
8905  {
8906  if (expected->field_count < actual->field_count)
8907  {
8908  todo_wine_if (todo)
8909  ok_(file, line) (FALSE, "%s: in msg 0x%08x expecting field count %d got %d\n",
8910  context, expected->message, expected->field_count, actual->field_count);
8911  failcount++;
8912  }
8913 
8914  for (i = 0; i <= actual->field_count; i++)
8915  {
8916  if (expected->match[i] && strcmp(expected->field[i], actual->field[i]))
8917  {
8918  todo_wine_if (todo)
8919  ok_(file, line) (FALSE, "%s: in msg 0x%08x field %d: expected \"%s\", got \"%s\"\n",
8920  context, expected->message, i, expected->field[i], actual->field[i]);
8921  failcount++;
8922  }
8923  }
8924 
8925  expected++;
8926  actual++;
8927  }
8928  else if (expected->optional)
8929  {
8930  expected++;
8931  }
8932  else
8933  {
8934  todo_wine_if (todo)
8935  ok_(file, line) (FALSE, "%s: the msg 0x%08x was expected, but got msg 0x%08x instead\n",
8936  context, expected->message, actual->message);
8937  failcount++;
8938  if (todo)
8939  goto done;
8940  expected++;
8941  actual++;
8942  }
8943  }
8944 
8945  if (expected->message || actual->message)
8946  {
8947  todo_wine_if (todo)
8948  ok_(file, line) (FALSE, "%s: the msg sequence is not complete: expected %08x - actual %08x\n",
8949  context, expected->message, actual->message);
8950  failcount++;
8951  }
8952 
8953  if(todo && !failcount) /* succeeded yet marked todo */
8954  {
8955  todo_wine
8956  ok_(file, line)(TRUE, "%s: marked \"todo_wine\" but succeeds\n", context);
8957  }
8958 
8959 done:
8960  flush_sequence();
8961 }
#define TRUE
Definition: types.h:120
#define ok_(x1, x2)
Definition: http.c:6587
BOOL todo
Definition: filedlg.c:313
static void add_message(const struct externalui_message *msg)
Definition: package.c:8865
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static struct externalui_message * sequence
Definition: package.c:8862
Definition: parser.c:48
#define todo_wine_if(is_todo)
Definition: test.h:155
#define todo_wine
Definition: test.h:154
char field[4][100]
Definition: package.c:8857
static void flush_sequence(void)
Definition: package.c:8883
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
BOOL expected
Definition: store.c:2063
Definition: fci.c:126

◆ package_from_db()

static UINT package_from_db ( MSIHANDLE  hdb,
MSIHANDLE handle 
)
static

Definition at line 950 of file package.c.

951 {
952  UINT res;
953  CHAR szPackage[12];
954  MSIHANDLE hPackage;
955 
956  sprintf(szPackage, "#%u", hdb);
957  res = MsiOpenPackageA(szPackage, &hPackage);
958  if (res != ERROR_SUCCESS)
959  {
960  MsiCloseHandle(hdb);
961  return res;
962  }
963 
964  res = MsiCloseHandle(hdb);
965  if (res != ERROR_SUCCESS)
966  {
967  MsiCloseHandle(hPackage);
968  return res;
969  }
970 
971  *handle = hPackage;
972  return ERROR_SUCCESS;
973 }
UINT WINAPI MsiOpenPackageA(LPCSTR szPackage, MSIHANDLE *phPackage)
Definition: package.c:1687
#define ERROR_SUCCESS
Definition: deptool.c:10
char CHAR
Definition: xmlstorage.h:175
unsigned long MSIHANDLE
Definition: msiserver.idl:25
#define sprintf(buf, format,...)
Definition: sprintf.c:55
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
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_getproperty(), 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 169 of file package.c.

170 {
171  LONG ret;
172  DWORD dwMaxSubkeyLen, dwMaxValueLen;
173  DWORD dwMaxLen, dwSize;
174  WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf;
175  HKEY hSubKey = hKey;
176 
177  if(lpszSubKey)
178  {
179  ret = RegOpenKeyExW(hKey, lpszSubKey, 0, access, &hSubKey);
180  if (ret) return ret;
181  }
182 
183  ret = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL,
184  &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
185  if (ret) goto cleanup;
186 
187  dwMaxSubkeyLen++;
188  dwMaxValueLen++;
189  dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
190  if (dwMaxLen > sizeof(szNameBuf)/sizeof(WCHAR))
191  {
192  /* Name too big: alloc a buffer for it */
193  if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen*sizeof(WCHAR))))
194  {
196  goto cleanup;
197  }
198  }
199 
200  /* Recursively delete all the subkeys */
201  while (TRUE)
202  {
203  dwSize = dwMaxLen;
204  if (RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL,
205  NULL, NULL, NULL)) break;
206 
207  ret = package_RegDeleteTreeW(hSubKey, lpszName, access);
208  if (ret) goto cleanup;
209  }
210 
211  if (lpszSubKey)
212  {
213  if (pRegDeleteKeyExW)
214  ret = pRegDeleteKeyExW(hKey, lpszSubKey, access, 0);
215  else
216  ret = RegDeleteKeyW(hKey, lpszSubKey);
217  }
218  else
219  while (TRUE)
220  {
221  dwSize = dwMaxLen;
222  if (RegEnumValueW(hKey, 0, lpszName, &dwSize,
223  NULL, NULL, NULL, NULL)) break;
224 
225  ret = RegDeleteValueW(hKey, lpszName);
226  if (ret) goto cleanup;
227  }
228 
229 cleanup:
230  if (lpszName != szNameBuf)
231  HeapFree(GetProcessHeap(), 0, lpszName);
232  if(lpszSubKey)
233  RegCloseKey(hSubKey);
234  return ret;
235 }
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1237
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
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
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
static LSTATUS package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey, REGSAM access)
Definition: package.c:169
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:3686
int ret
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2355
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
char * cleanup(char *str)
Definition: wpickclick.c:99
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 HeapFree(x, y, z)
Definition: compat.h:394
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by delete_component_path().

◆ query_file_path()

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

Definition at line 1201 of file package.c.

1202 {
1203  UINT r;
1204  DWORD size;
1205  MSIHANDLE rec;
1206 
1207  rec = MsiCreateRecord( 1 );
1208  ok(rec, "MsiCreate record failed\n");
1209 
1210  r = MsiRecordSetStringA( rec, 0, file );
1211  ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
1212 
1213  size = MAX_PATH;
1214  r = MsiFormatRecordA( hpkg, rec, buff, &size );
1215  ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
1216 
1217  MsiCloseHandle( rec );
1218 }
MSIHANDLE WINAPI MsiCreateRecord(UINT cParams)
Definition: record.c:95
UINT WINAPI MsiRecordSetStringA(MSIHANDLE handle, UINT iField, LPCSTR szValue)
Definition: record.c:601
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
unsigned long MSIHANDLE
Definition: msiserver.idl:25
#define ok(value,...)
GLsizeiptr size
Definition: glext.h:5919
UINT WINAPI MsiFormatRecordA(MSIHANDLE hInstall, MSIHANDLE hRecord, LPSTR szResult, LPDWORD sz)
Definition: format.c:966
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
unsigned int UINT
Definition: ndis.h:50
static unsigned char buff[32768]
Definition: fatten.c:17
Definition: fci.c:126

Referenced by test_settargetpath().

◆ remove_restore_point()

static void remove_restore_point ( DWORD  seq_number)
static

Definition at line 1071 of file package.c.

1072 {
1073  DWORD res;
1074 
1075  res = pSRRemoveRestorePoint(seq_number);
1076  if (res != ERROR_SUCCESS)
1077  trace("Failed to remove the restore point : %08x\n", res);
1078 }
#define trace(...)
Definition: kmt_test.h:217
#define ERROR_SUCCESS
Definition: deptool.c:10
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 430 of file package.c.

431 {
432  MSIHANDLE hview = 0;
433  UINT r;
434 
435  r = MsiDatabaseOpenViewA(hdb, query, &hview);
436  if( r != ERROR_SUCCESS )
437  return r;
438 
439  r = MsiViewExecute(hview, 0);
440  if( r == ERROR_SUCCESS )
441  r = MsiViewClose(hview);
442  MsiCloseHandle(hview);
443  return r;
444 }
UINT WINAPI MsiViewExecute(MSIHANDLE hView, MSIHANDLE hRec)
Definition: msiquery.c:459
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
UINT WINAPI MsiDatabaseOpenViewA(MSIHANDLE hdb, LPCSTR szQuery, MSIHANDLE *phView)
Definition: msiquery.c:88
unsigned long MSIHANDLE
Definition: msiserver.idl:25
UINT WINAPI MsiViewClose(MSIHANDLE hView)
Definition: msiquery.c:427
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
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(), 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 5093 of file package.c.

5094 {
5095  int i, size;
5096  DWORD attr, drives;
5097 
5098  size = lstrlenA(relative);
5099  drives = GetLogicalDrives();
5100  lstrcpyA(absolute, "A:\\");
5101  for (i = 0; i < 26; absolute[0] = '\0', i++)
5102  {
5103  if (!(drives & (1 << i)))
5104  continue;
5105 
5106  absolute[0] = 'A' + i;
5107  if (GetDriveTypeA(absolute) != DRIVE_FIXED)
5108  continue;
5109 
5110  lstrcpynA(absolute + 3, relative, size + 1);
5111  attr = GetFileAttributesA(absolute);
5112  if (attr != INVALID_FILE_ATTRIBUTES &&
5114  {
5115  if (absolute[3 + size - 1] != '\\')
5116  lstrcatA(absolute, "\\");
5117  break;
5118  }
5119  absolute[3] = '\0';
5120  }
5121 }
UINT WINAPI GetDriveTypeA(IN LPCSTR lpRootPathName)
Definition: disk.c:468
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
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:786
#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:170
#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
#define lstrcpynA
Definition: compat.h:408

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 288 of file package.c.

290 {
291  WCHAR guidW[MAX_PATH];
292  WCHAR squashedW[MAX_PATH];
293  CHAR squashed[MAX_PATH];
294  CHAR comppath[MAX_PATH];
295  CHAR prodpath[MAX_PATH];
296  CHAR path[MAX_PATH];
297  LPCSTR prod = NULL;
298  HKEY hkey;
300 
301  if (is_wow64)
303 
304  MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
305  squash_guid(guidW, squashedW);
306  WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
307 
309  {
310  prod = "3D0DAE300FACA1300AD792060BCDAA92";
311  sprintf(comppath,
312  "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
313  "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed);
314  lstrcpyA(prodpath,
315  "SOFTWARE\\Classes\\Installer\\"
316  "Products\\3D0DAE300FACA1300AD792060BCDAA92");
317  }
319  {
320  prod = "7D2F387510109040002000060BECB6AB";
321  sprintf(comppath,
322  "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
323  "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
324  sprintf(prodpath,
325  "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
326  "Installer\\%s\\Installer\\Products\\"
327  "7D2F387510109040002000060BECB6AB", usersid);
328  }
330  {
331  prod = "7D2F387510109040002000060BECB6AB";
332  sprintf(comppath,
333  "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
334  "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
335  sprintf(prodpath,
336  "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
337  "Installer\\Managed\\%s\\Installer\\Products\\"
338  "7D2F387510109040002000060BECB6AB", usersid);
339  }
340 
341  RegCreateKeyExA(HKEY_LOCAL_MACHINE, comppath, 0, NULL, 0, access, NULL, &hkey, NULL);
342 
344  lstrcatA(path, "\\");
345  if (!dir) lstrcatA(path, filename);
346 
347  RegSetValueExA(hkey, prod, 0, REG_SZ, (LPBYTE)path, lstrlenA(path));
348  RegCloseKey(hkey);
349 
350  RegCreateKeyExA(HKEY_LOCAL_MACHINE, prodpath, 0, NULL, 0, access, NULL, &hkey, NULL);
351  RegCloseKey(hkey);
352 }
#define WideCharToMultiByte
Definition: compat.h:101
Definition: http.c:6587
#define CP_ACP
Definition: compat.h:99
char CHAR
Definition: xmlstorage.h:175
const char * filename
Definition: ioapi.h:135
static BOOL squash_guid(LPCWSTR in, LPWSTR out)
Definition: package.c:237
#define sprintf(buf, format,...)
Definition: sprintf.c:55
const GUID * guid
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
smooth NULL
Definition: ftsmooth.c:416
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:26
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:35
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
Definition: services.c:325
ACCESS_MASK REGSAM
Definition: winreg.h:69
#define MultiByteToWideChar
Definition: compat.h:100
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4812
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 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 6223 of file package.c.

6224 {
6225  MSIHANDLE summary;
6226  UINT r;
6227 
6228  r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
6229  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6230 
6231  r = MsiSummaryInfoSetPropertyA(summary, prop, VT_I4, val, NULL, NULL);
6232  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6233 
6234  r = MsiSummaryInfoPersist(summary);
6235  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6236 
6237  MsiCloseHandle(summary);
6238 }
Definition: compat.h:1939
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
unsigned long MSIHANDLE
Definition: msiserver.idl:25
#define ok(value,...)
UINT WINAPI MsiSummaryInfoSetPropertyA(MSIHANDLE handle, UINT uiProperty, UINT uiDataType, INT iValue, FILETIME *pftValue, LPCSTR szValue)
Definition: suminfo.c:863
smooth NULL
Definition: ftsmooth.c:416
GLuint GLfloat * val
Definition: glext.h:7180
UINT WINAPI MsiGetSummaryInformationA(MSIHANDLE hDatabase, LPCSTR szDatabase, UINT uiUpdateCount, MSIHANDLE *pHandle)
Definition: suminfo.c:586
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
unsigned int UINT
Definition: ndis.h:50
UINT WINAPI MsiSummaryInfoPersist(MSIHANDLE handle)
Definition: suminfo.c:1152

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 2541 of file package.c.

2542 {
2543  MSIHANDLE summary;
2544  UINT r;
2545 
2546  r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2547  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2548 
2550  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2551 
2552  r = MsiSummaryInfoPersist(summary);
2553  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2554 
2555  MsiCloseHandle(summary);
2556 }
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3835
Definition: compat.h:1939
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
unsigned long MSIHANDLE
Definition: msiserver.idl:25
#define ok(value,...)
UINT WINAPI MsiSummaryInfoSetPropertyA(MSIHANDLE handle, UINT uiProperty, UINT uiDataType, INT iValue, FILETIME *pftValue, LPCSTR szValue)
Definition: suminfo.c:863
smooth NULL
Definition: ftsmooth.c:416
UINT WINAPI MsiGetSummaryInformationA(MSIHANDLE hDatabase, LPCSTR szDatabase, UINT uiUpdateCount, MSIHANDLE *pHandle)
Definition: suminfo.c:586
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
unsigned int UINT
Definition: ndis.h:50
UINT WINAPI MsiSummaryInfoPersist(MSIHANDLE handle)
Definition: suminfo.c:1152

Referenced by test_msipackage().

◆ set_summary_info()

static UINT set_summary_info ( MSIHANDLE  hdb)
static

Definition at line 875 of file package.c.

876 {
877  UINT res;
879 
880  /* build summary info */
882  ok( res == ERROR_SUCCESS , "Failed to open summaryinfo\n" );
883 
885  "Installation Database");
886  ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
887 
889  "Installation Database");
890  ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
891 
893  "Wine Hackers");
894  ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
895 
897  ";1033");
898  ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
899 
901  "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}");
902  ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
903 
905  ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
906 
908  ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
909 
911  ok( res == ERROR_SUCCESS , "Failed to make summary info persist\n" );
912 
914  ok( res == ERROR_SUCCESS , "Failed to close suminfo\n" );
915 
916  return res;
917 }
Definition: compat.h:1939
#define ERROR_SUCCESS
Definition: deptool.c:10
unsigned long MSIHANDLE
Definition: msiserver.idl:25
static const CHAR suminfo[]
Definition: db.c:2211
#define ok(value,...)
UINT WINAPI MsiSummaryInfoSetPropertyA(MSIHANDLE handle, UINT uiProperty, UINT uiDataType, INT iValue, FILETIME *pftValue, LPCSTR szValue)
Definition: suminfo.c:863
smooth NULL
Definition: ftsmooth.c:416
UINT WINAPI MsiGetSummaryInformationA(MSIHANDLE hDatabase, LPCSTR szDatabase, UINT uiUpdateCount, MSIHANDLE *pHandle)
Definition: suminfo.c:586
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
unsigned int UINT
Definition: ndis.h:50
UINT WINAPI MsiSummaryInfoPersist(MSIHANDLE handle)
Definition: suminfo.c:1152
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 2524 of file package.c.

2525 {
2526  MSIHANDLE summary;
2527  UINT r;
2528 
2529  r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2530  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2531 
2532  r = MsiSummaryInfoSetPropertyA(summary, pid, VT_LPSTR, 0, NULL, value);
2533  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2534 
2535  r = MsiSummaryInfoPersist(summary);
2536  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2537 
2538  MsiCloseHandle(summary);
2539 }
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3835
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
unsigned long MSIHANDLE
Definition: msiserver.idl:25
#define ok(value,...)
UINT WINAPI MsiSummaryInfoSetPropertyA(MSIHANDLE handle, UINT uiProperty, UINT uiDataType, INT iValue, FILETIME *pftValue, LPCSTR szValue)
Definition: suminfo.c:863
smooth NULL
Definition: ftsmooth.c:416
UINT WINAPI MsiGetSummaryInformationA(MSIHANDLE hDatabase, LPCSTR szDatabase, UINT uiUpdateCount, MSIHANDLE *pHandle)
Definition: suminfo.c:586
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
unsigned int UINT
Definition: ndis.h:50
UINT WINAPI MsiSummaryInfoPersist(MSIHANDLE handle)
Definition: suminfo.c:1152

Referenced by test_msipackage().

◆ squash_guid()

static BOOL squash_guid ( LPCWSTR  in,
LPWSTR  out 
)
static

Definition at line 237 of file package.c.

238 {
239  DWORD i,n=1;
240  GUID guid;
241 
242  if (FAILED(CLSIDFromString((LPCOLESTR)in, &guid)))
243  return FALSE;
244 
245  for(i=0; i<8; i++)
246  out[7-i] = in[n++];
247  n++;
248  for(i=0; i<4; i++)
249  out[11-i] = in[n++];
250  n++;
251  for(i=0; i<4; i++)
252  out[15-i] = in[n++];
253  n++;
254  for(i=0; i<2; i++)
255  {
256  out[17+i*2] = in[n++];
257  out[16+i*2] = in[n++];
258  }
259  n++;
260  for( ; i<8; i++)
261  {
262  out[17+i*2] = in[n++];
263  out[16+i*2] = in[n++];
264  }
265  out[32]=0;
266  return TRUE;
267 }
#define TRUE
Definition: types.h:120
GLdouble n
Definition: glext.h:7729
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
const GUID * guid
static FILE * out
Definition: regtests2xml.c:44
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint in
Definition: glext.h:9616
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2247

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

◆ START_TEST()

START_TEST ( package  )

Definition at line 9691 of file package.c.

9692 {
9694  BOOL ret = FALSE;
9695 
9697 
9698  if (pIsWow64Process)
9699  pIsWow64Process(GetCurrentProcess(), &is_wow64);
9700 
9702 
9703  /* Create a restore point ourselves so we circumvent the multitude of restore points
9704  * that would have been created by all the installation and removal tests.
9705  *
9706  * This is not needed on version 5.0 where setting MSIFASTINSTALL prevents the
9707  * creation of restore points.
9708  */
9709  if (pSRSetRestorePointA && !pMsiGetComponentPathExA)
9710  {
9711  memset(&status, 0, sizeof(status));
9713  }
9714 
9716  test_doaction();
9719  test_props();
9721  test_condition();
9722  test_msipackage();
9725  test_states();
9726  test_getproperty();
9727  test_removefiles();
9728  test_appsearch();
9736  test_ccpsearch();
9737  test_complocator();
9740  test_sourcedir();
9741  test_access();
9749  test_externalui();
9753 
9754  if (pSRSetRestorePointA && !pMsiGetComponentPathExA && ret)
9755  {
9757  if (ret)
9758  remove_restore_point(status.llSequenceNumber);
9759  }
9760 }
static void test_getproperty(void)
Definition: package.c:3782
static void test_sourcedir(void)
Definition: package.c:7355
static void test_props(void)
Definition: package.c:2153
static void test_createpackage(void)
Definition: package.c:1085
static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
Definition: package.c:1059
static void test_featureparents(void)
Definition: package.c:5331
static void test_formatrecord_tables(void)
Definition: package.c:2743
static void test_appsearch_inilocator(void)
Definition: package.c:4886
static void test_appsearch_complocator(void)
Definition: package.c:4055
static void test_appsearch_reglocator(void)
Definition: package.c:4304
static void test_MsiDatabaseCommit(void)
Definition: package.c:8712
static void test_gettargetpath_bad(void)
Definition: package.c:1134
static void test_MsiApplyPatch(void)
Definition: package.c:8512
#define END_NESTED_SYSTEM_CHANGE
unsigned int BOOL
Definition: ntddk_ex.h:94
static void remove_restore_point(DWORD seq_number)
Definition: package.c:1071
static void test_removefiles(void)
Definition: package.c:3833
static void test_MsiGetProductProperty(void)
Definition: package.c:8024
static void test_MsiEnumComponentCosts(void)
Definition: package.c:8523
static void test_ccpsearch(void)
Definition: package.c:5936
#define BEGIN_NESTED_SYSTEM_CHANGE
static void test_installprops(void)
Definition: package.c:5501
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1168
#define MAX_PATH
Definition: compat.h:26
static void test_MsiGetSourcePath(void)
Definition: package.c:6240
static void test_controlevent(void)
Definition: package.c:9372
static void test_doaction(void)
Definition: package.c:1104
static void test_condition(void)
Definition: package.c:1388
static void test_settargetpath(void)
Definition: package.c:1220
static void test_shortlongsource(void)
Definition: package.c:7021
static void test_externalui(void)
Definition: package.c:8781
int ret
static void test_appsearch_drlocator(void)
Definition: package.c:5123
static void test_MsiApplyMultiplePatches(void)
Definition: package.c:8468
static void test_appsearch(void)
Definition: package.c:3982
static void test_top_level_action(void)
Definition: package.c:9600
static void test_complocator(void)
Definition: package.c:5982
static char CURR_DIR[MAX_PATH]
Definition: package.c:39
static void test_launchconditions(void)
Definition: package.c:5887
static BOOL is_wow64
Definition: package.c:35
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2145
static void test_emptypackage(void)
Definition: package.c:7859
static void test_access(void)
Definition: package.c:7825
static void test_formatrecord2(void)
Definition: package.c:2653
static void test_property_table(void)
Definition: package.c:2365
static void test_externalui_message(void)
Definition: package.c:9158
static void test_MsiSetProperty(void)
Definition: package.c:8353
static void test_msipackage(void)
Definition: package.c:2558
static void test_states(void)
Definition: package.c:3056
static STATEMGRSTATUS *static void init_functionpointers(void)
Definition: package.c:57
#define memset(x, y, z)
Definition: compat.h:39
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

◆ test_access()

static void test_access ( void  )
static

Definition at line 7825 of file package.c.

7826 {
7827  MSIHANDLE hdb;
7828  UINT r;
7829 
7831  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7832 
7834 
7835  r = MsiDatabaseCommit(hdb);
7836  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7837 
7839  MsiCloseHandle(hdb);
7840 
7843 
7845  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7846 
7848 
7849  r = MsiDatabaseCommit(hdb);
7850  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7851 
7853  MsiCloseHandle(hdb);
7854 
7857 }
static const struct access_res create_close[16]
Definition: package.c:7760
#define ERROR_SUCCESS
Definition: deptool.c:10
static const struct access_res create_commit[16]
Definition: package.c:7740
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static const char msifile[]
Definition: package.c:36
#define test_file_access(file, ares)
Definition: package.c:7823
unsigned long MSIHANDLE
Definition: msiserver.idl:25
#define ok(value,...)
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:270
static const WCHAR msifileW[]
Definition: package.c:37
UINT WINAPI MsiDatabaseCommit(MSIHANDLE hdb)
Definition: msiquery.c:813
UINT WINAPI MsiOpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIHANDLE *phDB)
Definition: database.c:303
unsigned int UINT
Definition: ndis.h:50
static const struct access_res create[16]
Definition: package.c:7720

Referenced by START_TEST().

◆ test_appsearch()

static void test_appsearch ( void  )
static

Definition at line 3982 of file package.c.

3983 {
3984  MSIHANDLE hpkg;
3985  UINT r;
3986  MSIHANDLE hdb;
3987  CHAR prop[MAX_PATH];
3988  DWORD size;
3989  HKEY hkey;
3990  const char reg_expand_value[] = "%systemroot%\\system32\\notepad.exe";
3991 
3992  hdb = create_package_db();
3993  ok ( hdb, "failed to create package database\n" );
3994 
3995  create_appsearch_table( hdb );
3996  add_appsearch_entry( hdb, "'WEBBROWSERPROG', 'NewSignature1'" );
3997  add_appsearch_entry( hdb, "'NOTEPAD', 'NewSignature2'" );
3998  add_appsearch_entry( hdb, "'REGEXPANDVAL', 'NewSignature3'" );
3999 
4000  create_reglocator_table( hdb );
4001  add_reglocator_entry( hdb, "NewSignature1", 0, "htmlfile\\shell\\open\\command", "", 1 );
4002 
4003  r = RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Winetest_msi", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hkey, NULL);
4004  ok( r == ERROR_SUCCESS, "Could not create key: %d.\n", r );
4005  r = RegSetValueExA(hkey, NULL, 0, REG_EXPAND_SZ, (const BYTE*)reg_expand_value, strlen(reg_expand_value) + 1);
4006  ok( r == ERROR_SUCCESS, "Could not set key value: %d.\n", r);
4007  RegCloseKey(hkey);
4008  add_reglocator_entry( hdb, "NewSignature3", 1, "Software\\Winetest_msi", "", 1 );
4009 
4010  create_drlocator_table( hdb );
4011  add_drlocator_entry( hdb, "'NewSignature2', 0, 'c:\\windows\\system32', 0" );
4012 
4013  create_signature_table( hdb );
4014  add_signature_entry( hdb, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
4015  add_signature_entry( hdb, "'NewSignature2', 'NOTEPAD.EXE|notepad.exe', '', '', '', '', '', '', ''" );
4016  add_signature_entry( hdb, "'NewSignature3', 'NOTEPAD.EXE|notepad.exe', '', '', '', '', '', '', ''" );
4017 
4018  r = package_from_db( hdb, &hpkg );
4020  {
4021  skip("Not enough rights to perform tests\n");
4023  return;
4024  }
4025  ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
4026  MsiCloseHandle( hdb );
4027  if (r != ERROR_SUCCESS)
4028  goto done;
4029 
4031 
4032  r = MsiDoActionA( hpkg, "AppSearch" );
4033  ok( r == ERROR_SUCCESS, "AppSearch failed: %d\n", r);
4034 
4035  size = sizeof(prop);
4036  r = MsiGetPropertyA( hpkg, "WEBBROWSERPROG", prop, &size );
4037  ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
4038  ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
4039 
4040  size = sizeof(prop);
4041  r = MsiGetPropertyA( hpkg, "NOTEPAD", prop, &size );
4042  ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
4043 
4044  size = sizeof(prop);
4045  r = MsiGetPropertyA( hpkg, "REGEXPANDVAL", prop, &size );
4046  ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
4047  ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
4048 
4049 done:
4050  MsiCloseHandle( hpkg );
4052  RegDeleteKeyA(HKEY_CURRENT_USER, "Software\\Winetest_msi");
4053 }
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
UINT WINAPI MsiGetPropertyA(MSIHANDLE hInstall, LPCSTR szName, LPSTR szValueBuf, LPDWORD pchValueBuf)
Definition: package.c:2488
#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:36
static UINT package_from_db(MSIHANDLE hdb, MSIHANDLE *handle)
Definition: package.c:950
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2313
#define add_signature_entry(hdb, values)
Definition: package.c:795
unsigned long MSIHANDLE
Definition: msiserver.idl:25
static UINT create_drlocator_table(MSIHANDLE hdb)
Definition: package.c:634
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
GLsizeiptr size
Definition: glext.h:5919
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
static UINT create_signature_table(MSIHANDLE hdb)
Definition: package.c:545
UINT WINAPI MsiDoActionA(MSIHANDLE hInstall, LPCSTR szAction)
Definition: install.c:45
unsigned char BYTE
Definition: mem.h:68
#define add_appsearch_entry(hdb, values)
Definition: package.c:791
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
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
unsigned int UINT
Definition: ndis.h:50
#define skip(...)
static UINT add_reglocator_entry(MSIHANDLE hdb, const char *sig, UINT root, const char *path, const char *name, UINT type)
Definition: package.c:857
static UINT create_appsearch_table(MSIHANDLE hdb)
Definition: package.c:520
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4812
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:531
#define add_drlocator_entry(hdb, values)
Definition: package.c:824
static MSIHANDLE create_package_db(void)
Definition: package.c:920

Referenced by START_TEST().

◆ test_appsearch_complocator()

static void test_appsearch_complocator ( void  )
static

Definition at line 4055 of file package.c.

4056 {
4057  MSIHANDLE hpkg, hdb;
4058  char path[MAX_PATH], expected[MAX_PATH], prop[MAX_PATH];
4059  LPSTR usersid;
4060  DWORD size;
4061  UINT r;
4062 
4063  if (!(usersid = get_user_sid()))
4064  return;
4065 
4066  if (is_process_limited())
4067  {
4068  skip("process is limited\n");
4069  return;
4070  }
4071 
4072  create_test_file("FileName1");
4073  create_test_file("FileName4");
4075  "{A8AE6692-96BA-4198-8399-145D7D1D0D0E}", NULL, FALSE);
4076 
4077  create_test_file("FileName2");
4079  "{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}", usersid, FALSE);
4080 
4081  create_test_file("FileName3");
4083  "{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}", usersid, FALSE);
4084 
4085  create_test_file("FileName5");
4087  "{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}", NULL, TRUE);
4088 
4089  create_test_file("FileName6");
4091  "{C0ECD96F-7898-4410-9667-194BD8C1B648}", NULL, TRUE);
4092 
4093  create_test_file("FileName7");
4095  "{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}", NULL, FALSE);
4096 
4097  /* dir is FALSE, but we're pretending it's a directory */
4099  "{91B7359B-07F2-4221-AA8D-DE102BB87A5F}", NULL, FALSE);
4100 
4101  create_file_with_version("FileName8.dll", MAKELONG(2, 1), MAKELONG(4, 3));
4103  "{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}", NULL, FALSE);
4104 
4105  create_file_with_version("FileName9.dll", MAKELONG(1, 2), MAKELONG(3, 4));
4107  "{A204DF48-7346-4635-BA2E-66247DBAC9DF}", NULL, FALSE);
4108 
4109  create_file_with_version("FileName10.dll", MAKELONG(2, 1), MAKELONG(4, 3));
4111  "{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}", NULL, FALSE);
4112 
4113  hdb = create_package_db();
4114  ok(hdb, "Expected a valid database handle\n");
4115 
4117  add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
4118  add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
4119  add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
4120  add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
4121  add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
4122  add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
4123  add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
4124  add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
4125  add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
4126  add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
4127  add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
4128  add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
4129 
4131 
4132  /* published component, machine, file, signature, misdbLocatorTypeFile */
4133  add_complocator_entry(hdb, "'NewSignature1', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 1");
4134 
4135  /* published component, user-unmanaged, file, signature, misdbLocatorTypeFile */
4136  add_complocator_entry(hdb, "'NewSignature2', '{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}', 1");
4137 
4138  /* published component, user-managed, file, signature, misdbLocatorTypeFile */
4139  add_complocator_entry(hdb, "'NewSignature3', '{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}', 1");
4140 
4141  /* published component, machine, file, signature, misdbLocatorTypeDirectory */
4142  add_complocator_entry(hdb, "'NewSignature4', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 0");
4143 
4144  /* published component, machine, dir, signature, misdbLocatorTypeDirectory */
4145  add_complocator_entry(hdb, "'NewSignature5', '{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}', 0");
4146 
4147  /* published component, machine, dir, no signature, misdbLocatorTypeDirectory */
4148  add_complocator_entry(hdb, "'NewSignature6', '{C0ECD96F-7898-4410-9667-194BD8C1B648}', 0");
4149 
4150  /* published component, machine, file, no signature, misdbLocatorTypeFile */
4151  add_complocator_entry(hdb, "'NewSignature7', '{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}', 1");
4152 
4153  /* unpublished component, no signature, misdbLocatorTypeDir */
4154  add_complocator_entry(hdb, "'NewSignature8', '{FB671D5B-5083-4048-90E0-481C48D8F3A5}', 0");
4155 
4156  /* published component, no signature, dir does not exist misdbLocatorTypeDir */
4157  add_complocator_entry(hdb, "'NewSignature9', '{91B7359B-07F2-4221-AA8D-DE102BB87A5F}', 0");
4158 
4159  /* published component, signature w/ ver, misdbLocatorTypeFile */
4160  add_complocator_entry(hdb, "'NewSignature10', '{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}', 1");
4161 
4162  /* published component, signature w/ ver, ver > max, misdbLocatorTypeFile */
4163  add_complocator_entry(hdb, "'NewSignature11', '{A204DF48-7346-4635-BA2E-66247DBAC9DF}', 1");
4164 
4165  /* published component, signature w/ ver, sig->name ignored, misdbLocatorTypeFile */
4166  add_complocator_entry(hdb, "'NewSignature12', '{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}', 1");
4167 
4169  add_signature_entry(hdb, "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''");
4170  add_signature_entry(hdb, "'NewSignature2', 'FileName2', '', '', '', '', '', '', ''");
4171  add_signature_entry(hdb, "'NewSignature3', 'FileName3', '', '', '', '', '', '', ''");
4172  add_signature_entry(hdb, "'NewSignature4', 'FileName4', '', '', '', '', '', '', ''");
4173  add_signature_entry(hdb, "'NewSignature5', 'FileName5', '', '', '', '', '', '', ''");
4174  add_signature_entry(hdb, "'NewSignature10', 'FileName8.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
4175  add_signature_entry(hdb, "'NewSignature11', 'FileName9.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
4176  add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
4177 
4178  r = package_from_db(hdb, &hpkg);
4180  {
4181  skip("Not enough rights to perform tests\n");
4182  goto error;
4183  }
4184  ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
4185 
4186  r = MsiSetPropertyA(hpkg, "SIGPROP8", "october");
4187  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4188 
4190 
4191  r = MsiDoActionA(hpkg, "AppSearch");
4192  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4193 
4195  if (is_root(CURR_DIR)) expected[2] = 0;
4196 
4197  size = MAX_PATH;
4198  sprintf(path, "%s\\FileName1", expected);
4199  r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
4200  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4201  ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
4202 
4203  size = MAX_PATH;
4204  sprintf(path, "%s\\FileName2", expected);
4205  r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
4206  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4207  ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
4208 
4209  size = MAX_PATH;
4210  sprintf(path, "%s\\FileName3", expected);
4211  r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
4212  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4213  ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
4214 
4215  size = MAX_PATH;
4216  sprintf(path, "%s\\FileName4", expected);
4217  r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
4218  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4219  ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
4220