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

Go to the source code of this file.

Classes

struct  _tagVS_VERSIONINFO
 
struct  access_res
 
struct  externalui_message
 

Macros

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

Typedefs

typedef struct _tagVS_VERSIONINFO VS_VERSIONINFO
 

Functions

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

Variables

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

Macro Definition Documentation

◆ add_actiontext_entry

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

Definition at line 850 of file package.c.

◆ add_appsearch_entry

#define add_appsearch_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "AppSearch", hdb, values, \
"INSERT INTO `AppSearch` " \
"(`Property`, `Signature_`) VALUES( %s )")

Definition at line 782 of file package.c.

◆ add_ccpsearch_entry

#define add_ccpsearch_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "CCPSearch", hdb, values, \
"INSERT INTO `CCPSearch` (`Signature_`) VALUES( %s )")

Definition at line 818 of file package.c.

◆ add_complocator_entry

#define add_complocator_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "CompLocator", hdb, values, \
"INSERT INTO `CompLocator` " \
"(`Signature_`, `ComponentId`, `Type`) VALUES( %s )")

Definition at line 825 of file package.c.

◆ add_component_entry

#define add_component_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "Component", hdb, values, \
"INSERT INTO `Component` " \
"(`Component`, `ComponentId`, `Directory_`, " \
"`Attributes`, `Condition`, `KeyPath`) VALUES( %s )")

Definition at line 759 of file package.c.

◆ add_control_entry

#define add_control_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "Control", hdb, values, \
"INSERT INTO `Control` " \
"(`Dialog_`, `Control`, `Type`, `X`, `Y`, `Width`, `Height`, `Attributes`, `Text`) VALUES( %s )");

Definition at line 842 of file package.c.

◆ add_controlevent_entry

#define add_controlevent_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "ControlEvent", hdb, values, \
"INSERT INTO `ControlEvent` " \
"(`Dialog_`, `Control_`, `Event`, `Argument`, `Condition`, `Ordering`) VALUES( %s )");

Definition at line 846 of file package.c.

◆ add_custom_action_entry

#define add_custom_action_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "CustomAction", hdb, values, \
"INSERT INTO `CustomAction` " \
"(`Action`, `Type`, `Source`, `Target`) VALUES( %s )")

Definition at line 834 of file package.c.

◆ add_dialog_entry

#define add_dialog_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "Dialog", hdb, values, \
"INSERT INTO `Dialog` " \
"(`Dialog`, `HCentering`, `VCentering`, `Width`, `Height`, `Attributes`, `Control_First`) VALUES ( %s )")

Definition at line 838 of file package.c.

◆ add_directory_entry

#define add_directory_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "Directory", hdb, values, \
"INSERT INTO `Directory` " \
"(`Directory`,`Directory_Parent`,`DefaultDir`) VALUES( %s )")

Definition at line 764 of file package.c.

◆ add_drlocator_entry

#define add_drlocator_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "DrLocator", hdb, values, \
"INSERT INTO `DrLocator` " \
"(`Signature_`, `Parent`, `Path`, `Depth`) VALUES( %s )")

Definition at line 821 of file package.c.

◆ add_feature_components_entry

#define add_feature_components_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "FeatureComponents", hdb, values, \
"INSERT INTO `FeatureComponents` " \
"(`Feature_`, `Component_`) VALUES( %s )")

Definition at line 773 of file package.c.

◆ add_feature_entry

#define add_feature_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "Feature", hdb, values, \
"INSERT INTO `Feature` " \
"(`Feature`, `Feature_Parent`, `Title`, `Description`, " \
"`Display`, `Level`, `Directory_`, `Attributes`) VALUES( %s )")

Definition at line 768 of file package.c.

◆ add_file_entry

#define add_file_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "File", hdb, values, \
"INSERT INTO `File` " \
"(`File`, `Component_`, `FileName`, `FileSize`, " \
"`Version`, `Language`, `Attributes`, `Sequence`) VALUES( %s )")

Definition at line 777 of file package.c.

◆ add_inilocator_entry

#define add_inilocator_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "IniLocator", hdb, values, \
"INSERT INTO `IniLocator` " \
"(`Signature_`, `FileName`, `Section`, `Key`, `Field`, `Type`) " \
"VALUES( %s )")

Definition at line 829 of file package.c.

◆ add_install_execute_sequence_entry

#define add_install_execute_sequence_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "InstallExecuteSequence", hdb, values, \
"INSERT INTO `InstallExecuteSequence` " \
"(`Action`, `Condition`, `Sequence`) VALUES( %s )")

Definition at line 805 of file package.c.

◆ add_install_ui_sequence_entry

#define add_install_ui_sequence_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "InstallUISequence", hdb, values, \
"INSERT INTO `InstallUISequence` " \
"(`Action`, `Condition`, `Sequence`) VALUES( %s )")

Definition at line 809 of file package.c.

◆ add_launchcondition_entry

#define add_launchcondition_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "LaunchCondition", hdb, values, \
"INSERT INTO `LaunchCondition` " \
"(`Condition`, `Description`) VALUES( %s )")

Definition at line 792 of file package.c.

◆ add_media_entry

#define add_media_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "Media", hdb, values, \
"INSERT INTO `Media` " \
"(`DiskId`, `LastSequence`, `DiskPrompt`, " \
"`Cabinet`, `VolumeLabel`, `Source`) VALUES( %s )")

Definition at line 813 of file package.c.

◆ add_property_entry

#define add_property_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "Property", hdb, values, \
"INSERT INTO `Property` (`Property`, `Value`) VALUES( %s )")

Definition at line 796 of file package.c.

◆ add_signature_entry

#define add_signature_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "Signature", hdb, values, \
"INSERT INTO `Signature` " \
"(`Signature`, `FileName`, `MinVersion`, `MaxVersion`," \
" `MinSize`, `MaxSize`, `MinDate`, `MaxDate`, `Languages`) " \
"VALUES( %s )")

Definition at line 786 of file package.c.

◆ add_upgrade_entry

#define add_upgrade_entry (   hdb,
  values 
)
Value:
add_entry(__FILE__, __LINE__, "Upgrade", hdb, values, \
"INSERT INTO `Upgrade` " \
"(`UpgradeCode`, `VersionMin`, `VersionMax`, `Language`, `Attributes`, `Remove`, `ActionProperty`) VALUES( %s )");

Definition at line 854 of file package.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 22 of file package.c.

◆ GET_PROC

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

◆ ok_sequence

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

Definition at line 8895 of file package.c.

◆ roundoffs

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

Definition at line 1009 of file package.c.

◆ roundpos

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

Definition at line 1010 of file package.c.

◆ test_file_access

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

Definition at line 7747 of file package.c.

◆ update_ProductCode_property

#define update_ProductCode_property (   hdb,
  value 
)
Value:
add_entry(__FILE__, __LINE__, "Property", hdb, value, \
"UPDATE `Property` SET `Value` = '%s' WHERE `Property` = 'ProductCode'")
Definition: pdh_main.c:94

Definition at line 802 of file package.c.

◆ update_ProductVersion_property

#define update_ProductVersion_property (   hdb,
  value 
)
Value:
add_entry(__FILE__, __LINE__, "Property", hdb, value, \
"UPDATE `Property` SET `Value` = '%s' WHERE `Property` = 'ProductVersion'")

Definition at line 799 of file package.c.

Typedef Documentation

◆ VS_VERSIONINFO

Function Documentation

◆ _test_file_access()

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

Definition at line 7704 of file package.c.

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

◆ add_entry()

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

Definition at line 745 of file package.c.

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

◆ add_message()

static void add_message ( const struct externalui_message msg)
static

Definition at line 8798 of file package.c.

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

◆ add_reglocator_entry()

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

Definition at line 858 of file package.c.

860{
861 const char insert[] =
862 "INSERT INTO `RegLocator` (`Signature_`, `Root`, `Key`, `Name`, `Type`) "
863 "VALUES( '%s', %u, '%s', '%s', %u )";
864 char *query;
865 UINT sz, r;
866
867 sz = strlen( sig ) + 10 + strlen( path ) + strlen( name ) + 10 + sizeof( insert );
868 query = malloc( sz );
869 sprintf( query, insert, sig, root, path, name, type );
870 r = run_query( hdb, query );
871 free( query );
872 ok(r == ERROR_SUCCESS, "failed to insert into reglocator table: %u\n", r); \
873 return r;
874}
Definition: name.c:39

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

◆ BOOL()

static BOOL ( WINAPI pIsWow64Process)
static

◆ check_prop()

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

Definition at line 2140 of file package.c.

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

Referenced by test_installprops(), and test_props().

◆ create_actiontext_table()

static UINT create_actiontext_table ( MSIHANDLE  hdb)
static

Definition at line 717 of file package.c.

718{
719 UINT r = run_query(hdb,
720 "CREATE TABLE `ActionText` ("
721 "`Action` CHAR(72) NOT NULL, "
722 "`Description` CHAR(64) LOCALIZABLE, "
723 "`Template` CHAR(128) LOCALIZABLE "
724 "PRIMARY KEY `Action`)");
725 ok(r == ERROR_SUCCESS, "Failed to create ActionText table: %u\n", r);
726 return r;
727}

Referenced by test_externalui_message().

◆ create_appsearch_table()

static UINT create_appsearch_table ( MSIHANDLE  hdb)
static

Definition at line 495 of file package.c.

496{
497 UINT r = run_query( hdb,
498 "CREATE TABLE `AppSearch` ("
499 "`Property` CHAR(72) NOT NULL, "
500 "`Signature_` CHAR(72) NOT NULL "
501 "PRIMARY KEY `Property`, `Signature_`)" );
502 ok(r == ERROR_SUCCESS, "Failed to create AppSearch table: %u\n", r);
503 return r;
504}

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

◆ create_ccpsearch_table()

static UINT create_ccpsearch_table ( MSIHANDLE  hdb)
static

Definition at line 599 of file package.c.

600{
601 UINT r = run_query( hdb,
602 "CREATE TABLE `CCPSearch` ("
603 "`Signature_` CHAR(72) NOT NULL "
604 "PRIMARY KEY `Signature_`)" );
605 ok(r == ERROR_SUCCESS, "Failed to create CCPSearch table: %u\n", r);
606 return r;
607}

Referenced by test_ccpsearch().

◆ create_complocator_table()

static UINT create_complocator_table ( MSIHANDLE  hdb)
static

Definition at line 622 of file package.c.

623{
624 UINT r = run_query( hdb,
625 "CREATE TABLE `CompLocator` ("
626 "`Signature_` CHAR(72) NOT NULL, "
627 "`ComponentId` CHAR(38) NOT NULL, "
628 "`Type` SHORT "
629 "PRIMARY KEY `Signature_`)" );
630 ok(r == ERROR_SUCCESS, "Failed to create CompLocator table: %u\n", r);
631 return r;
632}

Referenced by test_appsearch_complocator(), and test_complocator().

◆ create_component_table()

static UINT create_component_table ( MSIHANDLE  hdb)
static

Definition at line 421 of file package.c.

422{
423 UINT r = run_query( hdb,
424 "CREATE TABLE `Component` ( "
425 "`Component` CHAR(72) NOT NULL, "
426 "`ComponentId` CHAR(38), "
427 "`Directory_` CHAR(72) NOT NULL, "
428 "`Attributes` SHORT NOT NULL, "
429 "`Condition` CHAR(255), "
430 "`KeyPath` CHAR(72) "
431 "PRIMARY KEY `Component`)" );
432 ok(r == ERROR_SUCCESS, "Failed to create Component table: %u\n", r);
433 return r;
434}

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

◆ create_control_table()

static UINT create_control_table ( MSIHANDLE  hdb)
static

Definition at line 681 of file package.c.

682{
683 UINT r = run_query(hdb,
684 "CREATE TABLE `Control` ("
685 "`Dialog_` CHAR(72) NOT NULL, "
686 "`Control` CHAR(50) NOT NULL, "
687 "`Type` CHAR(20) NOT NULL, "
688 "`X` SHORT NOT NULL, "
689 "`Y` SHORT NOT NULL, "
690 "`Width` SHORT NOT NULL, "
691 "`Height` SHORT NOT NULL, "
692 "`Attributes` LONG, "
693 "`Property` CHAR(50), "
694 "`Text` CHAR(0) LOCALIZABLE, "
695 "`Control_Next` CHAR(50), "
696 "`Help` CHAR(255) LOCALIZABLE "
697 "PRIMARY KEY `Dialog_`, `Control`)");
698 ok(r == ERROR_SUCCESS, "Failed to create Control table: %u\n", r);
699 return r;
700}

Referenced by test_controlevent(), and test_externalui_message().

◆ create_controlevent_table()

static UINT create_controlevent_table ( MSIHANDLE  hdb)
static

Definition at line 702 of file package.c.

703{
704 UINT r = run_query(hdb,
705 "CREATE TABLE `ControlEvent` ("
706 "`Dialog_` CHAR(72) NOT NULL, "
707 "`Control_` CHAR(50) NOT NULL, "
708 "`Event` CHAR(50) NOT NULL, "
709 "`Argument` CHAR(255) NOT NULL, "
710 "`Condition` CHAR(255), "
711 "`Ordering` SHORT "
712 "PRIMARY KEY `Dialog_`, `Control_`, `Event`, `Argument`, `Condition`)");
713 ok(r == ERROR_SUCCESS, "Failed to create ControlEvent table: %u\n", r);
714 return r;
715}

Referenced by test_controlevent().

◆ create_custom_action_table()

static UINT create_custom_action_table ( MSIHANDLE  hdb)
static

Definition at line 649 of file package.c.

650{
651 UINT r = run_query( hdb,
652 "CREATE TABLE `CustomAction` ("
653 "`Action` CHAR(72) NOT NULL, "
654 "`Type` SHORT NOT NULL, "
655 "`Source` CHAR(75), "
656 "`Target` CHAR(255) "
657 "PRIMARY KEY `Action`)" );
658 ok(r == ERROR_SUCCESS, "Failed to create CustomAction table: %u\n", r);
659 return r;
660}

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

◆ create_dialog_table()

static UINT create_dialog_table ( MSIHANDLE  hdb)
static

Definition at line 662 of file package.c.

663{
664 UINT r = run_query(hdb,
665 "CREATE TABLE `Dialog` ("
666 "`Dialog` CHAR(72) NOT NULL, "
667 "`HCentering` SHORT NOT NULL, "
668 "`VCentering` SHORT NOT NULL, "
669 "`Width` SHORT NOT NULL, "
670 "`Height` SHORT NOT NULL, "
671 "`Attributes` LONG, "
672 "`Title` CHAR(128) LOCALIZABLE, "
673 "`Control_First` CHAR(50) NOT NULL, "
674 "`Control_Default` CHAR(50), "
675 "`Control_Cancel` CHAR(50) "
676 "PRIMARY KEY `Dialog`)");
677 ok(r == ERROR_SUCCESS, "Failed to create Dialog table: %u\n", r);
678 return r;
679}

Referenced by test_controlevent(), and test_externalui_message().

◆ create_drlocator_table()

static UINT create_drlocator_table ( MSIHANDLE  hdb)
static

Definition at line 609 of file package.c.

610{
611 UINT r = run_query( hdb,
612 "CREATE TABLE `DrLocator` ("
613 "`Signature_` CHAR(72) NOT NULL, "
614 "`Parent` CHAR(72), "
615 "`Path` CHAR(255), "
616 "`Depth` SHORT "
617 "PRIMARY KEY `Signature_`, `Parent`, `Path`)" );
618 ok(r == ERROR_SUCCESS, "Failed to create DrLocator table: %u\n", r);
619 return r;
620}

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

◆ create_feature_components_table()

static UINT create_feature_components_table ( MSIHANDLE  hdb)
static

Definition at line 453 of file package.c.

454{
455 UINT r = run_query( hdb,
456 "CREATE TABLE `FeatureComponents` ( "
457 "`Feature_` CHAR(38) NOT NULL, "
458 "`Component_` CHAR(72) NOT NULL "
459 "PRIMARY KEY `Feature_`, `Component_` )" );
460 ok(r == ERROR_SUCCESS, "Failed to create FeatureComponents table: %u\n", r);
461 return r;
462}

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

◆ create_feature_table()

static UINT create_feature_table ( MSIHANDLE  hdb)
static

Definition at line 436 of file package.c.

437{
438 UINT r = run_query( hdb,
439 "CREATE TABLE `Feature` ( "
440 "`Feature` CHAR(38) NOT NULL, "
441 "`Feature_Parent` CHAR(38), "
442 "`Title` CHAR(64), "
443 "`Description` CHAR(255), "
444 "`Display` SHORT NOT NULL, "
445 "`Level` SHORT NOT NULL, "
446 "`Directory_` CHAR(72), "
447 "`Attributes` SHORT NOT NULL "
448 "PRIMARY KEY `Feature`)" );
449 ok(r == ERROR_SUCCESS, "Failed to create Feature table: %u\n", r);
450 return r;
451}

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

◆ create_file_data()

static void create_file_data ( LPCSTR  name,
LPCSTR  data 
)
static

Definition at line 976 of file package.c.

977{
978 HANDLE file;
979 DWORD written;
980
982 ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
984 return;
985
986 WriteFile(file, data, strlen(data), &written, NULL);
987 WriteFile(file, "\n", strlen("\n"), &written, NULL);
988
990}
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define CREATE_ALWAYS
Definition: disk.h:72

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

◆ create_file_table()

static UINT create_file_table ( MSIHANDLE  hdb)
static

Definition at line 464 of file package.c.

465{
466 UINT r = run_query( hdb,
467 "CREATE TABLE `File` ("
468 "`File` CHAR(72) NOT NULL, "
469 "`Component_` CHAR(72) NOT NULL, "
470 "`FileName` CHAR(255) NOT NULL, "
471 "`FileSize` LONG NOT NULL, "
472 "`Version` CHAR(72), "
473 "`Language` CHAR(20), "
474 "`Attributes` SHORT, "
475 "`Sequence` SHORT NOT NULL "
476 "PRIMARY KEY `File`)" );
477 ok(r == ERROR_SUCCESS, "Failed to create File table: %u\n", r);
478 return r;
479}

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

◆ create_file_with_version()

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

Definition at line 1012 of file package.c.

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

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

◆ create_inilocator_table()

static UINT create_inilocator_table ( MSIHANDLE  hdb)
static

Definition at line 634 of file package.c.

635{
636 UINT r = run_query( hdb,
637 "CREATE TABLE `IniLocator` ("
638 "`Signature_` CHAR(72) NOT NULL, "
639 "`FileName` CHAR(255) NOT NULL, "
640 "`Section` CHAR(96)NOT NULL, "
641 "`Key` CHAR(128)NOT NULL, "
642 "`Field` SHORT, "
643 "`Type` SHORT "
644 "PRIMARY KEY `Signature_`)" );
645 ok(r == ERROR_SUCCESS, "Failed to create IniLocator table: %u\n", r);
646 return r;
647}

Referenced by test_appsearch_inilocator().

◆ create_install_execute_sequence_table()

static UINT create_install_execute_sequence_table ( MSIHANDLE  hdb)
static

Definition at line 560 of file package.c.

561{
562 UINT r = run_query( hdb,
563 "CREATE TABLE `InstallExecuteSequence` ("
564 "`Action` CHAR(72) NOT NULL, "
565 "`Condition` CHAR(255), "
566 "`Sequence` SHORT "
567 "PRIMARY KEY `Action`)" );
568 ok(r == ERROR_SUCCESS, "Failed to create InstallExecuteSequence table: %u\n", r);
569 return r;
570}

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

◆ create_install_ui_sequence_table()

static UINT create_install_ui_sequence_table ( MSIHANDLE  hdb)
static

Definition at line 572 of file package.c.

573{
574 UINT r = run_query( hdb,
575 "CREATE TABLE `InstallUISequence` ("
576 "`Action` CHAR(72) NOT NULL, "
577 "`Condition` CHAR(255), "
578 "`Sequence` SHORT "
579 "PRIMARY KEY `Action`)" );
580 ok(r == ERROR_SUCCESS, "Failed to create InstallUISequence table: %u\n", r);
581 return r;
582}

Referenced by test_top_level_action().

◆ create_launchcondition_table()

static UINT create_launchcondition_table ( MSIHANDLE  hdb)
static

Definition at line 538 of file package.c.

539{
540 UINT r = run_query( hdb,
541 "CREATE TABLE `LaunchCondition` ("
542 "`Condition` CHAR(255) NOT NULL, "
543 "`Description` CHAR(255) NOT NULL "
544 "PRIMARY KEY `Condition`)" );
545 ok(r == ERROR_SUCCESS, "Failed to create LaunchCondition table: %u\n", r);
546 return r;
547}

Referenced by test_launchconditions().

◆ create_media_table()

static UINT create_media_table ( MSIHANDLE  hdb)
static

Definition at line 584 of file package.c.

585{
586 UINT r = run_query( hdb,
587 "CREATE TABLE `Media` ("
588 "`DiskId` SHORT NOT NULL, "
589 "`LastSequence` SHORT NOT NULL, "
590 "`DiskPrompt` CHAR(64), "
591 "`Cabinet` CHAR(255), "
592 "`VolumeLabel` CHAR(32), "
593 "`Source` CHAR(72) "
594 "PRIMARY KEY `DiskId`)" );
595 ok(r == ERROR_SUCCESS, "Failed to create Media table: %u\n", r);
596 return r;
597}

Referenced by test_costs(), and test_states().

◆ create_package_db()

static MSIHANDLE create_package_db ( void  )
static

Definition at line 921 of file package.c.

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

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

◆ create_property_table()

static UINT create_property_table ( MSIHANDLE  hdb)
static

Definition at line 549 of file package.c.

550{
551 UINT r = run_query( hdb,
552 "CREATE TABLE `Property` ("
553 "`Property` CHAR(72) NOT NULL, "
554 "`Value` CHAR(0) "
555 "PRIMARY KEY `Property`)" );
556 ok(r == ERROR_SUCCESS, "Failed to create Property table: %u\n", r);
557 return r;
558}

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

◆ create_reglocator_table()

static UINT create_reglocator_table ( MSIHANDLE  hdb)
static

Definition at line 506 of file package.c.

507{
508 UINT r = run_query( hdb,
509 "CREATE TABLE `RegLocator` ("
510 "`Signature_` CHAR(72) NOT NULL, "
511 "`Root` SHORT NOT NULL, "
512 "`Key` CHAR(255) NOT NULL, "
513 "`Name` CHAR(255), "
514 "`Type` SHORT "
515 "PRIMARY KEY `Signature_`)" );
516 ok(r == ERROR_SUCCESS, "Failed to create RegLocator table: %u\n", r);
517 return r;
518}

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

◆ create_remove_file_table()

static UINT create_remove_file_table ( MSIHANDLE  hdb)
static

Definition at line 481 of file package.c.

482{
483 UINT r = run_query( hdb,
484 "CREATE TABLE `RemoveFile` ("
485 "`FileKey` CHAR(72) NOT NULL, "
486 "`Component_` CHAR(72) NOT NULL, "
487 "`FileName` CHAR(255) LOCALIZABLE, "
488 "`DirProperty` CHAR(72) NOT NULL, "
489 "`InstallMode` SHORT NOT NULL "
490 "PRIMARY KEY `FileKey`)" );
491 ok(r == ERROR_SUCCESS, "Failed to create RemoveFile table: %u\n", r);
492 return r;
493}

Referenced by test_removefiles().

◆ create_signature_table()

static UINT create_signature_table ( MSIHANDLE  hdb)
static

Definition at line 520 of file package.c.

521{
522 UINT r = run_query( hdb,
523 "CREATE TABLE `Signature` ("
524 "`Signature` CHAR(72) NOT NULL, "
525 "`FileName` CHAR(255) NOT NULL, "
526 "`MinVersion` CHAR(20), "
527 "`MaxVersion` CHAR(20), "
528 "`MinSize` LONG, "
529 "`MaxSize` LONG, "
530 "`MinDate` LONG, "
531 "`MaxDate` LONG, "
532 "`Languages` CHAR(255) "
533 "PRIMARY KEY `Signature`)" );
534 ok(r == ERROR_SUCCESS, "Failed to create Signature table: %u\n", r);
535 return r;
536}

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

◆ create_test_guid()

static void create_test_guid ( LPSTR  prodcode,
LPSTR  squashed 
)
static

Definition at line 244 of file package.c.

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

Referenced by test_MsiGetProductProperty().

◆ create_upgrade_table()

static UINT create_upgrade_table ( MSIHANDLE  hdb)
static

Definition at line 729 of file package.c.

730{
731 UINT r = run_query( hdb,
732 "CREATE TABLE `Upgrade` ("
733 "`UpgradeCode` CHAR(38) NOT NULL, "
734 "`VersionMin` CHAR(20), "
735 "`VersionMax` CHAR(20), "
736 "`Language` CHAR(255), "
737 "`Attributes` SHORT, "
738 "`Remove` CHAR(255), "
739 "`ActionProperty` CHAR(72) NOT NULL "
740 "PRIMARY KEY `UpgradeCode`, `VersionMin`, `VersionMax`, `Language`)" );
741 ok(r == ERROR_SUCCESS, "Failed to create Upgrade table: %u\n", r);
742 return r;
743}

Referenced by test_states().

◆ delete_component_path()

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

Definition at line 329 of file package.c.

330{
331 WCHAR guidW[MAX_PATH];
332 WCHAR squashedW[MAX_PATH];
334 CHAR squashed[MAX_PATH];
335 CHAR comppath[MAX_PATH + 81];
336 CHAR prodpath[MAX_PATH];
338
339 if (is_wow64)
341
342 MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
343 squash_guid(guidW, squashedW);
344 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
345
347 {
348 sprintf(comppath,
349 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
350 "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed);
351 lstrcpyA(prodpath,
352 "SOFTWARE\\Classes\\Installer\\"
353 "Products\\3D0DAE300FACA1300AD792060BCDAA92");
354 }
356 {
357 sprintf(comppath,
358 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
359 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
360 sprintf(prodpath,
361 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
362 "Installer\\%s\\Installer\\Products\\"
363 "7D2F387510109040002000060BECB6AB", usersid);
364 }
366 {
367 sprintf(comppath,
368 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
369 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
370 sprintf(prodpath,
371 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
372 "Installer\\Managed\\%s\\Installer\\Products\\"
373 "7D2F387510109040002000060BECB6AB", usersid);
374 }
375
376 MultiByteToWideChar(CP_ACP, 0, comppath, -1, substrW, MAX_PATH);
378
379 MultiByteToWideChar(CP_ACP, 0, prodpath, -1, substrW, MAX_PATH);
381}
#define MultiByteToWideChar
Definition: compat.h:110
static const WCHAR substrW[]
Definition: string.c:60
BOOL is_wow64
Definition: msi.c:54
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
static LSTATUS package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey, REGSAM access)
Definition: package.c:146
@ MSIINSTALLCONTEXT_MACHINE
Definition: msi.h:200
@ MSIINSTALLCONTEXT_USERUNMANAGED
Definition: msi.h:199
@ MSIINSTALLCONTEXT_USERMANAGED
Definition: msi.h:198
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
Definition: http.c:7252
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
ACCESS_MASK REGSAM
Definition: winreg.h:69
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46

Referenced by test_appsearch_complocator(), and test_complocator().

◆ delete_key()

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

Definition at line 119 of file package.c.

120{
121 if (pRegDeleteKeyExA)
122 return pRegDeleteKeyExA( key, subkey, access, 0 );
123 return RegDeleteKeyA( key, subkey );
124}
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1224
Definition: copy.c:22

◆ delete_win_ini()

static void delete_win_ini ( LPCSTR  file)
static

Definition at line 4947 of file package.c.

4948{
4950
4952 lstrcatA(path, "\\");
4953 lstrcatA(path, file);
4954
4956}
UINT WINAPI GetWindowsDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2337

Referenced by test_appsearch_inilocator().

◆ do_query()

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

Definition at line 383 of file package.c.

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

Referenced by test_MsiSetProperty(), and test_property_table().

◆ externalui_callback()

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

Definition at line 8692 of file package.c.

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

Referenced by test_externalui().

◆ externalui_message_callback()

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

Definition at line 9055 of file package.c.

9056{
9057 INT retval = context ? *((INT *)context) : 0;
9058 struct externalui_message msg;
9059 char buffer[256];
9060 DWORD length;
9061 UINT r;
9062 int i;
9063
9064 msg.message = message;
9066 {
9067 /* trying to access the record seems to hang on some versions of Windows */
9068 msg.field_count = -1;
9069 add_message(&msg);
9070 return 1;
9071 }
9072 msg.field_count = MsiRecordGetFieldCount(hrecord);
9073 for (i = 0; i <= msg.field_count; i++)
9074 {
9075 length = sizeof(buffer);
9076 r = MsiRecordGetStringA(hrecord, i, buffer, &length);
9077 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
9078 memcpy(msg.field[i], buffer, min(100, length+1));
9079 }
9080
9081 /* top-level actions dump a list of all set properties; skip them since they're inconsistent */
9082 if (message == (INSTALLMESSAGE_INFO|MB_ICONHAND) && msg.field_count > 0 && !strncmp(msg.field[0], "Property", 8))
9083 return retval;
9084
9085 add_message(&msg);
9086
9087 return retval;
9088}
#define add_message(msg)
Definition: SystemMenu.c:98
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
UINT WINAPI MsiRecordGetStringA(MSIHANDLE handle, UINT iField, char *szValue, DWORD *pcchValue)
Definition: record.c:403
UINT WINAPI MsiRecordGetFieldCount(MSIHANDLE handle)
Definition: record.c:113
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define min(a, b)
Definition: monoChain.cc:55
@ INSTALLMESSAGE_TERMINATE
Definition: msi.h:107
@ INSTALLMESSAGE_INFO
Definition: msi.h:98
Definition: tftpd.h:60
int32_t INT
Definition: typedefs.h:58
#define MB_ICONHAND
Definition: winuser.h:788

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

◆ externalui_message_string_callback()

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

Definition at line 9042 of file package.c.

9043{
9044 INT retval = context ? *((INT *)context) : 0;
9045 struct externalui_message msg;
9046
9047 msg.message = message;
9048 msg.field_count = 0;
9049 strcpy(msg.field[0], string);
9050 add_message(&msg);
9051
9052 return retval;
9053}
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388

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

◆ externalui_record_callback()

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

Definition at line 8701 of file package.c.

8702{
8703 INT retval = context ? *((INT *)context) : 0;
8704 UINT r;
8706 ok(message_type == INSTALLMESSAGE_USER, "expected INSTALLMESSAGE_USER, got %08x\n", message_type);
8707 r = MsiRecordGetFieldCount(hrecord);
8708 ok(r == 1, "expected 1, got %u\n", r);
8709 r = MsiRecordGetInteger(hrecord, 1);
8710 ok(r == 12345, "expected 12345, got %u\n", r);
8711 return retval;
8712}
int WINAPI MsiRecordGetInteger(MSIHANDLE handle, UINT iField)
Definition: record.c:237
static int externalui_record_ran
Definition: package.c:8699

Referenced by test_externalui().

◆ find_prop_in_property()

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

Definition at line 2329 of file package.c.

2330{
2331 MSIHANDLE hview, hrec;
2332 BOOL found = FALSE;
2334 DWORD sz;
2335 UINT r;
2336
2337 r = MsiDatabaseOpenViewA(hdb, "SELECT * FROM `_Property`", &hview);
2338 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
2339 r = MsiViewExecute(hview, 0);
2340 ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n");
2341
2342 if (len < 0) len = lstrlenA(val);
2343
2344 while (r == ERROR_SUCCESS && !found)
2345 {
2346 r = MsiViewFetch(hview, &hrec);
2347 if (r != ERROR_SUCCESS) break;
2348
2349 sz = MAX_PATH;
2350 r = MsiRecordGetStringA(hrec, 1, buffer, &sz);
2351 if (r == ERROR_SUCCESS && !lstrcmpA(buffer, prop))
2352 {
2353 sz = MAX_PATH;
2354 r = MsiRecordGetStringA(hrec, 2, buffer, &sz);
2355 if (r == ERROR_SUCCESS && !memcmp(buffer, val, len) && !buffer[len])
2356 {
2357 ok(sz == len, "wrong size %lu\n", sz);
2358 found = TRUE;
2359 }
2360 }
2361
2362 MsiCloseHandle(hrec);
2363 }
2364 MsiViewClose(hview);
2365 MsiCloseHandle(hview);
2366 return found;
2367}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4194
GLuint GLfloat * val
Definition: glext.h:7180
GLenum GLsizei len
Definition: glext.h:6722

Referenced by test_property_table().

◆ flush_sequence()

static void flush_sequence ( void  )
static

Definition at line 8815 of file package.c.

8816{
8817 free(sequence);
8818 sequence = NULL;
8820}

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

◆ get_user_sid()

static char * get_user_sid ( void  )
static

Definition at line 126 of file package.c.

127{
129 DWORD size = 0;
131 char *usersid = NULL;
132
135
136 user = malloc(size);
138 ConvertSidToStringSidA(user->User.Sid, &usersid);
139 free(user);
140
142 return usersid;
143}
void user(int argc, const char *argv[])
Definition: cmds.c:1350
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:411
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:294
BOOL WINAPI ConvertSidToStringSidA(PSID Sid, LPSTR *StringSid)
Definition: security.c:3637
#define GetCurrentProcess()
Definition: compat.h:759
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210
#define TOKEN_QUERY
Definition: setypes.h:928
@ TokenUser
Definition: setypes.h:966

Referenced by test_appsearch_complocator().

◆ init_functionpointers()

static STATEMGRSTATUS *static void init_functionpointers ( void  )
static

Definition at line 49 of file package.c.

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

Referenced by START_TEST().

◆ INSTALLSTATE()

static INSTALLSTATE ( WINAPI pMsiGetComponentPathExA)
static

◆ is_process_limited()

static BOOL is_process_limited ( void  )
static

Definition at line 71 of file package.c.

72{
74 PSID Group = NULL;
75 BOOL IsInGroup;
77
79 DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
80 !CheckTokenMembership(NULL, Group, &IsInGroup))
81 {
82 trace("Could not check if the current user is an administrator\n");
84 return FALSE;
85 }
87
88 if (!IsInGroup)
89 {
93 0, 0, 0, 0, 0, 0, &Group) ||
94 !CheckTokenMembership(NULL, Group, &IsInGroup))
95 {
96 trace("Could not check if the current user is a power user\n");
97 return FALSE;
98 }
99 if (!IsInGroup)
100 {
101 /* Only administrators and power users can be powerful */
102 return TRUE;
103 }
104 }
105
107 {
108 BOOL ret;
110 DWORD size;
111
114 return (ret && type == TokenElevationTypeLimited);
115 }
116 return FALSE;
117}
#define trace
Definition: atltest.h:70
static SID_IDENTIFIER_AUTHORITY NtAuthority
Definition: security.c:40
BOOL WINAPI CheckTokenMembership(IN HANDLE ExistingTokenHandle, IN PSID SidToCheck, OUT PBOOL IsMember)
Definition: token.c:21
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:674
PVOID WINAPI FreeSid(PSID pSid)
Definition: security.c:698
_In_opt_ PSID Group
Definition: rtlfuncs.h:1646
enum _TOKEN_ELEVATION_TYPE TOKEN_ELEVATION_TYPE
@ TokenElevationTypeLimited
Definition: winnt_old.h:2488
@ TokenElevationTypeDefault
Definition: winnt_old.h:2486
#define SECURITY_BUILTIN_DOMAIN_RID
Definition: setypes.h:581
#define SECURITY_NT_AUTHORITY
Definition: setypes.h:554
@ TokenElevationType
Definition: setypes.h:983
#define DOMAIN_ALIAS_RID_POWER_USERS
Definition: setypes.h:655
#define DOMAIN_ALIAS_RID_ADMINS
Definition: setypes.h:652

Referenced by test_appsearch_complocator(), and test_states().

◆ is_root()

static BOOL is_root ( const char path)
static

◆ LONG()

static LONG ( WINAPI pRegDeleteKeyExA)
static

◆ notify_system_change()

static BOOL notify_system_change ( DWORD  event_type,
STATEMGRSTATUS status 
)
static

Definition at line 1060 of file package.c.

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

Referenced by START_TEST().

◆ ok_sequence_()

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

Definition at line 8822 of file package.c.

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

◆ package_from_db()

static UINT package_from_db ( MSIHANDLE  hdb,
MSIHANDLE handle 
)
static

◆ package_RegDeleteTreeW()

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

Definition at line 146 of file package.c.

147{
148 LONG ret;
149 DWORD dwMaxSubkeyLen, dwMaxValueLen;
150 DWORD dwMaxLen, dwSize;
151 WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf;
152 HKEY hSubKey = hKey;
153
154 if(lpszSubKey)
155 {
156 ret = RegOpenKeyExW(hKey, lpszSubKey, 0, access, &hSubKey);
157 if (ret) return ret;
158 }
159
160 ret = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL,
161 &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
162 if (ret) goto cleanup;
163
164 dwMaxSubkeyLen++;
165 dwMaxValueLen++;
166 dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
167 if (dwMaxLen > ARRAY_SIZE(szNameBuf))
168 {
169 /* Name too big: alloc a buffer for it */
170 if (!(lpszName = malloc(dwMaxLen * sizeof(WCHAR))))
171 {
173 goto cleanup;
174 }
175 }
176
177 /* Recursively delete all the subkeys */
178 while (TRUE)
179 {
180 dwSize = dwMaxLen;
181 if (RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL,
182 NULL, NULL, NULL)) break;
183
184 ret = package_RegDeleteTreeW(hSubKey, lpszName, access);
185 if (ret) goto cleanup;
186 }
187
188 if (lpszSubKey)
189 {
190 if (pRegDeleteKeyExW)
191 ret = pRegDeleteKeyExW(hKey, lpszSubKey, access, 0);
192 else
193 ret = RegDeleteKeyW(hKey, lpszSubKey);
194 }
195 else
196 while (TRUE)
197 {
198 dwSize = dwMaxLen;
199 if (RegEnumValueW(hKey, 0, lpszName, &dwSize,
200 NULL, NULL, NULL, NULL)) break;
201
202 ret = RegDeleteValueW(hKey, lpszName);
203 if (ret) goto cleanup;
204 }
205
206cleanup:
207 if (lpszName != szNameBuf) free(lpszName);
208 if (lpszSubKey) RegCloseKey(hSubKey);
209 return ret;
210}
#define ARRAY_SIZE(A)
Definition: main.h:33
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
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:2504
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1239
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2330
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:2830
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:3662
static void cleanup(void)
Definition: main.c:1335
FxAutoRegKey hKey
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
long LONG
Definition: pedump.c:60
#define max(a, b)
Definition: svc.c:63

Referenced by delete_component_path(), and package_RegDeleteTreeW().

◆ query_file_path()

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

Definition at line 1200 of file package.c.

1201{
1202 UINT r;
1203 DWORD size;
1204 MSIHANDLE rec;
1205
1206 rec = MsiCreateRecord( 1 );
1207 ok(rec, "MsiCreate record failed\n");
1208
1209 r = MsiRecordSetStringA( rec, 0, file );
1210 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
1211
1212 size = MAX_PATH;
1213 r = MsiFormatRecordA( hpkg, rec, buff, &size );
1214 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
1215
1216 MsiCloseHandle( rec );
1217}
UINT WINAPI MsiFormatRecordA(MSIHANDLE hinst, MSIHANDLE hrec, char *buf, DWORD *sz)
Definition: format.c:955
MSIHANDLE WINAPI MsiCreateRecord(UINT cParams)
Definition: record.c:92
UINT WINAPI MsiRecordSetStringA(MSIHANDLE handle, UINT iField, const char *szValue)
Definition: record.c:549
static unsigned char buff[32768]
Definition: fatten.c:17

Referenced by test_settargetpath().

◆ remove_restore_point()

static void remove_restore_point ( DWORD  seq_number)
static

Definition at line 1072 of file package.c.

1073{
1074 DWORD res;
1075
1076 res = pSRRemoveRestorePoint(seq_number);
1077 if (res != ERROR_SUCCESS)
1078 trace("Failed to remove the restore point: %#lx\n", res);
1079}

Referenced by START_TEST().

◆ run_query()

◆ search_absolute_directory()

static void search_absolute_directory ( LPSTR  absolute,
LPCSTR  relative 
)
static

Definition at line 5165 of file package.c.

5166{
5167 int i, size;
5168 DWORD attr, drives;
5169
5170 size = lstrlenA(relative);
5171 drives = GetLogicalDrives();
5172 lstrcpyA(absolute, "A:\\");
5173 for (i = 0; i < 26; absolute[0] = '\0', i++)
5174 {
5175 if (!(drives & (1 << i)))
5176 continue;
5177
5178 absolute[0] = 'A' + i;
5179 if (GetDriveTypeA(absolute) != DRIVE_FIXED)
5180 continue;
5181
5182 lstrcpynA(absolute + 3, relative, size + 1);
5183 attr = GetFileAttributesA(absolute);
5186 {
5187 if (absolute[3 + size - 1] != '\\')
5188 lstrcatA(absolute, "\\");
5189 break;
5190 }
5191 absolute[3] = '\0';
5192 }
5193}
#define lstrcpynA
Definition: compat.h:751
UINT WINAPI GetDriveTypeA(IN LPCSTR lpRootPathName)
Definition: disk.c:468
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:636
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
Definition: cookie.c:202
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
DWORD WINAPI GetLogicalDrives(void)
Definition: disk.c:110
#define DRIVE_FIXED
Definition: winbase.h:252

Referenced by test_appsearch_drlocator().

◆ set_component_path()

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

Definition at line 263 of file package.c.

265{
266 WCHAR guidW[MAX_PATH];
267 WCHAR squashedW[MAX_PATH];
268 CHAR squashed[MAX_PATH];
269 CHAR comppath[MAX_PATH + 81];
270 CHAR prodpath[MAX_PATH];
272 LPCSTR prod = NULL;
273 HKEY hkey;
275
276 if (is_wow64)
278
279 MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
280 squash_guid(guidW, squashedW);
281 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
282
284 {
285 prod = "3D0DAE300FACA1300AD792060BCDAA92";
286 sprintf(comppath,
287 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
288 "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed);
289 lstrcpyA(prodpath,
290 "SOFTWARE\\Classes\\Installer\\"
291 "Products\\3D0DAE300FACA1300AD792060BCDAA92");
292 }
294 {
295 prod = "7D2F387510109040002000060BECB6AB";
296 sprintf(comppath,
297 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
298 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
299 sprintf(prodpath,
300 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
301 "Installer\\%s\\Installer\\Products\\"
302 "7D2F387510109040002000060BECB6AB", usersid);
303 }
305 {
306 prod = "7D2F387510109040002000060BECB6AB";
307 sprintf(comppath,
308 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
309 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
310 sprintf(prodpath,
311 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
312 "Installer\\Managed\\%s\\Installer\\Products\\"
313 "7D2F387510109040002000060BECB6AB", usersid);
314 }
315
316 RegCreateKeyExA(HKEY_LOCAL_MACHINE, comppath, 0, NULL, 0, access, NULL, &hkey, NULL);
317
319 lstrcatA(path, "\\");
320 if (!dir) lstrcatA(path, filename);
321
322 RegSetValueExA(hkey, prod, 0, REG_SZ, (LPBYTE)path, lstrlenA(path));
323 RegCloseKey(hkey);
324
325 RegCreateKeyExA(HKEY_LOCAL_MACHINE, prodpath, 0, NULL, 0, access, NULL, &hkey, NULL);
326 RegCloseKey(hkey);
327}
unsigned int dir
Definition: maze.c:112
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4799
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:1034
const char * filename
Definition: ioapi.h:137
#define REG_SZ
Definition: layer.c:22
static char CURR_DIR[MAX_PATH]
Definition: package.c:39

Referenced by test_appsearch_complocator(), and test_complocator().

◆ set_suminfo_prop()

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

Definition at line 6147 of file package.c.

6148{
6149 MSIHANDLE summary;
6150 UINT r;
6151
6152 r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
6153 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6154
6155 r = MsiSummaryInfoSetPropertyA(summary, prop, VT_I4, val, NULL, NULL);
6156 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6157
6158 r = MsiSummaryInfoPersist(summary);
6159 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6160
6161 MsiCloseHandle(summary);
6162}
@ VT_I4
Definition: compat.h:2298
UINT WINAPI MsiSummaryInfoSetPropertyA(MSIHANDLE handle, UINT uiProperty, UINT uiDataType, INT iValue, FILETIME *pftValue, const char *szValue)
Definition: suminfo.c:937
UINT WINAPI MsiGetSummaryInformationA(MSIHANDLE hDatabase, const char *szDatabase, UINT uiUpdateCount, MSIHANDLE *pHandle)
Definition: suminfo.c:584
UINT WINAPI MsiSummaryInfoPersist(MSIHANDLE handle)
Definition: suminfo.c:1222

Referenced by test_MsiGetSourcePath(), and test_shortlongsource().

◆ set_summary_dword()

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

Definition at line 2545 of file package.c.

2546{
2547 MSIHANDLE summary;
2548 UINT r;
2549
2550 r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2551 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2552
2554 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2555
2556 r = MsiSummaryInfoPersist(summary);
2557 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2558
2559 MsiCloseHandle(summary);
2560}
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837

Referenced by test_msipackage().

◆ set_summary_info()

static UINT set_summary_info ( MSIHANDLE  hdb)
static

Definition at line 876 of file package.c.

877{
878 UINT res;
880
881 /* build summary info */
883 ok( res == ERROR_SUCCESS , "Failed to open summaryinfo\n" );
884
886 "Installation Database");
887 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
888
890 "Installation Database");
891 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
892
894 "Wine Hackers");
895 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
896
898 ";1033");
899 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
900
902 "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}");
903 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
904
906 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
907
909 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
910
912 ok( res == ERROR_SUCCESS , "Failed to make summary info persist\n" );
913
915 ok( res == ERROR_SUCCESS , "Failed to close suminfo\n" );
916
917 return res;
918}
static const CHAR suminfo[]
Definition: db.c:2206
@ VT_LPSTR
Definition: compat.h:2324

Referenced by create_package_db(), and test_MsiGetProductProperty().

◆ set_summary_str()

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

Definition at line 2528 of file package.c.

2529{
2530 MSIHANDLE summary;
2531 UINT r;
2532
2533 r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2534 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2535
2537 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2538
2539 r = MsiSummaryInfoPersist(summary);
2540 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2541
2542 MsiCloseHandle(summary);
2543}

Referenced by test_msipackage(), and test_states().

◆ squash_guid()

static BOOL squash_guid ( LPCWSTR  in,
LPWSTR  out 
)
static

Definition at line 212 of file package.c.

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

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

◆ START_TEST()

START_TEST ( package  )

Definition at line 9623 of file package.c.

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

◆ test_access()

static void test_access ( void  )
static

Definition at line 7749 of file package.c.

7750{
7751 MSIHANDLE hdb;
7752 UINT r;
7753
7755 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7756
7758
7759 r = MsiDatabaseCommit(hdb);
7760 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7761
7763 MsiCloseHandle(hdb);
7764
7767
7769 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7770
7772
7773 r = MsiDatabaseCommit(hdb);
7774 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7775
7777 MsiCloseHandle(hdb);
7778
7781}
static const struct access_res create[16]
Definition: package.c:7644
static const struct access_res create_close[16]
Definition: package.c:7684
static const struct access_res create_commit[16]
Definition: package.c:7664
#define test_file_access(file, ares)
Definition: package.c:7747
#define MSIDBOPEN_CREATEDIRECT
Definition: msiquery.h:70

Referenced by START_TEST().

◆ test_appsearch()

static void test_appsearch ( void  )
static

Definition at line 4010 of file package.c.

4011{
4012 MSIHANDLE hpkg;
4013 UINT r;
4014 MSIHANDLE hdb;
4015 CHAR prop[MAX_PATH];
4016 DWORD size;
4017 HKEY hkey;
4018 const char reg_expand_value[] = "%systemroot%\\system32\\notepad.exe";
4019
4020 hdb = create_package_db();
4021 ok ( hdb, "failed to create package database\n" );
4022
4024 add_appsearch_entry( hdb, "'WEBBROWSERPROG', 'NewSignature1'" );
4025 add_appsearch_entry( hdb, "'NOTEPAD', 'NewSignature2'" );
4026 add_appsearch_entry( hdb, "'REGEXPANDVAL', 'NewSignature3'" );
4027 add_appsearch_entry( hdb, "'32KEYVAL', 'NewSignature4'" );
4028 add_appsearch_entry( hdb, "'64KEYVAL', 'NewSignature5'" );
4029
4031 add_reglocator_entry( hdb, "NewSignature1", 0, "htmlfile\\shell\\open\\command", "", 1 );
4032
4033 r = RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Winetest_msi", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hkey, NULL);
4034 ok( r == ERROR_SUCCESS, "Could not create key: %d.\n", r );
4035 r = RegSetValueExA(hkey, NULL, 0, REG_EXPAND_SZ, (const BYTE*)reg_expand_value, strlen(reg_expand_value) + 1);
4036 ok( r == ERROR_SUCCESS, "Could not set key value: %d.\n", r);
4037 RegCloseKey(hkey);
4038 add_reglocator_entry( hdb, "NewSignature3", 1, "Software\\Winetest_msi", "", msidbLocatorTypeFileName );
4039
4040 r = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Winetest_msi", 0, NULL, 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY,
4041 NULL, &hkey, NULL);
4042 if (r == ERROR_ACCESS_DENIED)
4043 {
4044 skip("insufficient rights\n");
4045 RegDeleteKeyA(HKEY_CURRENT_USER, "Software\\Winetest_msi");
4046 MsiCloseHandle(hdb);
4048 return;
4049 }
4050 ok( r == ERROR_SUCCESS, "Could not create key: %d.\n", r );
4051
4052 r = RegSetValueExA(hkey, NULL, 0, REG_SZ, (const BYTE *)"c:\\windows\\system32\\notepad.exe",
4053 sizeof("c:\\windows\\system32\\notepad.exe"));
4054 ok( r == ERROR_SUCCESS, "Could not set key value: %d.\n", r);
4055 RegCloseKey(hkey);
4056 add_reglocator_entry( hdb, "NewSignature4", 2, "Software\\Winetest_msi", "", msidbLocatorTypeFileName );
4057
4058 r = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Winetest_msi", 0, NULL, 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY,
4059 NULL, &hkey, NULL);
4060 ok( r == ERROR_SUCCESS, "Could not create key: %d.\n", r );
4061 r = RegSetValueExA(hkey, NULL, 0, REG_SZ, (const BYTE *)"c:\\windows\\system32\\notepad.exe",
4062 sizeof("c:\\windows\\system32\\notepad.exe"));
4063 ok( r == ERROR_SUCCESS, "Could not set key value: %d.\n", r);
4064 RegCloseKey(hkey);
4065 add_reglocator_entry( hdb, "NewSignature5", 2, "Software\\Winetest_msi", "",
4067
4069 add_drlocator_entry( hdb, "'NewSignature2', 0, 'c:\\windows\\system32', 0" );
4070
4072 add_signature_entry( hdb, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
4073 add_signature_entry( hdb, "'NewSignature2', 'NOTEPAD.EXE|notepad.exe', '', '', '', '', '', '', ''" );
4074 add_signature_entry( hdb, "'NewSignature3', 'NOTEPAD.EXE|notepad.exe', '', '', '', '', '', '', ''" );
4075 add_signature_entry( hdb, "'NewSignature4', 'NOTEPAD.EXE|notepad.exe', '', '', '', '', '', '', ''" );
4076 add_signature_entry( hdb, "'NewSignature5', 'NOTEPAD.EXE|notepad.exe', '', '', '', '', '', '', ''" );
4077
4078 r = package_from_db( hdb, &hpkg );
4080 {
4081 skip("Not enough rights to perform tests\n");
4083 return;
4084 }
4085 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
4086 MsiCloseHandle( hdb );
4087 if (r != ERROR_SUCCESS)
4088 goto done;
4089
4091
4092 r = MsiDoActionA( hpkg, "AppSearch" );
4093 ok( r == ERROR_SUCCESS, "AppSearch failed: %d\n", r);
4094
4095 size = sizeof(prop);
4096 r = MsiGetPropertyA( hpkg, "WEBBROWSERPROG", prop, &size );
4097 ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
4098 ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
4099
4100 size = sizeof(prop);
4101 r = MsiGetPropertyA( hpkg, "NOTEPAD", prop, &size );
4102 ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
4103
4104 size = sizeof(prop);
4105 r = MsiGetPropertyA( hpkg, "REGEXPANDVAL", prop, &size );
4106 ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
4107 ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
4108
4109 size = sizeof(prop);
4110 r = MsiGetPropertyA( hpkg, "32KEYVAL", prop, &size );
4111 ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
4112 ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
4113
4114 size = sizeof(prop);
4115 r = MsiGetPropertyA( hpkg, "64KEYVAL", prop, &size );
4116 ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
4117 ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
4118
4119done:
4120 MsiCloseHandle( hpkg );
4122 RegDeleteKeyA(HKEY_CURRENT_USER, "Software\\Winetest_msi");
4123 delete_key(HKEY_LOCAL_MACHINE, "Software\\Winetest_msi", KEY_WOW64_32KEY);
4124 delete_key(HKEY_LOCAL_MACHINE, "Software\\Winetest_msi", KEY_WOW64_64KEY);
4125}
#define skip(...)
Definition: atltest.h:64
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
UINT WINAPI MsiDoActionA(MSIHANDLE hInstall, LPCSTR szAction)
Definition: install.c:45
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2284
#define add_signature_entry(hdb, values)
Definition: package.c:786
static UINT package_from_db(MSIHANDLE hdb, MSIHANDLE *handle)
Definition: package.c:951
static UINT create_appsearch_table(MSIHANDLE hdb)
Definition: package.c:495
static UINT create_reglocator_table(MSIHANDLE hdb)
Definition: package.c:506
static UINT create_drlocator_table(MSIHANDLE hdb)
Definition: package.c:609
static UINT add_reglocator_entry(MSIHANDLE hdb, const char *sig, UINT root, const char *path, const char *name, UINT type)
Definition: package.c:858
static MSIHANDLE create_package_db(void)
Definition: package.c:921
#define add_drlocator_entry(hdb, values)
Definition: package.c:821
static UINT create_signature_table(MSIHANDLE hdb)
Definition: package.c:520
#define add_appsearch_entry(hdb, values)
Definition: package.c:782
@ INSTALLUILEVEL_NONE
Definition: msi.h:66
@ msidbLocatorType64bit
Definition: msidefs.h:190
@ msidbLocatorTypeFileName
Definition: msidefs.h:188
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define delete_key(r, p, s)
Definition: reg_test.h:64
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define KEY_WOW64_32KEY
Definition: cmtypes.h:45

Referenced by START_TEST().

◆ test_appsearch_complocator()

static void test_appsearch_complocator ( void  )
static

Definition at line 4127 of file package.c.

4128{
4129 MSIHANDLE hpkg, hdb;
4130 char path[MAX_PATH + 15], expected[MAX_PATH], prop[MAX_PATH];
4131 LPSTR usersid;
4132 DWORD size;
4133 UINT r;
4134
4135 if (!(usersid = get_user_sid()))
4136 return;
4137
4138 if (is_process_limited())
4139 {
4140 skip("process is limited\n");
4141 return;
4142 }
4143
4144 create_test_file("FileName1");
4145 create_test_file("FileName4");
4147 "{A8AE6692-96BA-4198-8399-145D7D1D0D0E}", NULL, FALSE);
4148
4149 create_test_file("FileName2");
4151 "{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}", usersid, FALSE);
4152
4153 create_test_file("FileName3");
4155 "{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}", usersid, FALSE);
4156
4157 create_test_file("FileName5");
4159 "{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}", NULL, TRUE);
4160
4161 create_test_file("FileName6");
4163 "{C0ECD96F-7898-4410-9667-194BD8C1B648}", NULL, TRUE);
4164
4165 create_test_file("FileName7");
4167 "{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}", NULL, FALSE);
4168
4169 /* dir is FALSE, but we're pretending it's a directory */
4171 "{91B7359B-07F2-4221-AA8D-DE102BB87A5F}", NULL, FALSE);
4172
4173 create_file_with_version("FileName8.dll", MAKELONG(2, 1), MAKELONG(4, 3));
4175 "{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}", NULL, FALSE);
4176
4177 create_file_with_version("FileName9.dll", MAKELONG(1, 2), MAKELONG(3, 4));
4179 "{A204DF48-7346-4635-BA2E-66247DBAC9DF}", NULL, FALSE);
4180
4181 create_file_with_version("FileName10.dll", MAKELONG(2, 1), MAKELONG(4, 3));
4183 "{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}", NULL, FALSE);
4184
4185 hdb = create_package_db();
4186 ok(hdb, "Expected a valid database handle\n");
4187
4189 add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
4190 add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
4191 add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
4192 add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
4193 add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
4194 add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
4195 add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
4196 add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
4197 add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
4198 add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
4199 add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
4200 add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
4201
4203
4204 /* published component, machine, file, signature, misdbLocatorTypeFile */
4205 add_complocator_entry(hdb, "'NewSignature1', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 1");
4206
4207 /* published component, user-unmanaged, file, signature, misdbLocatorTypeFile */
4208 add_complocator_entry(hdb, "'NewSignature2', '{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}', 1");
4209
4210 /* published component, user-managed, file, signature, misdbLocatorTypeFile */
4211 add_complocator_entry(hdb, "'NewSignature3', '{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}', 1");
4212
4213 /* published component, machine, file, signature, misdbLocatorTypeDirectory */
4214 add_complocator_entry(hdb, "'NewSignature4', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 0");
4215
4216 /* published component, machine, dir, signature, misdbLocatorTypeDirectory */
4217 add_complocator_entry(hdb, "'NewSignature5', '{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}', 0");
4218
4219 /* published component, machine, dir, no signature, misdbLocatorTypeDirectory */
4220 add_complocator_entry(hdb, "'NewSignature6', '{C0ECD96F-7898-4410-9667-194BD8C1B648}', 0");
4221
4222 /* published component, machine, file, no signature, misdbLocatorTypeFile */
4223 add_complocator_entry(hdb, "'NewSignature7', '{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}', 1");
4224
4225 /* unpublished component, no signature, misdbLocatorTypeDir */
4226 add_complocator_entry(hdb, "'NewSignature8', '{FB671D5B-5083-4048-90E0-481C48D8F3A5}', 0");
4227
4228 /* published component, no signature, dir does not exist misdbLocatorTypeDir */
4229 add_complocator_entry(hdb, "'NewSignature9', '{91B7359B-07F2-4221-AA8D-DE102BB87A5F}', 0");
4230
4231 /* published component, signature w/ ver, misdbLocatorTypeFile */
4232 add_complocator_entry(hdb, "'NewSignature10', '{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}', 1");
4233
4234 /* published component, signature w/ ver, ver > max, misdbLocatorTypeFile */
4235 add_complocator_entry(hdb, "'NewSignature11', '{A204DF48-7346-4635-BA2E-66247DBAC9DF}', 1");
4236
4237 /* published component, signature w/ ver, sig->name ignored, misdbLocatorTypeFile */
4238 add_complocator_entry(hdb, "'NewSignature12', '{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}', 1");
4239
4241 add_signature_entry(hdb, "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''");
4242 add_signature_entry(hdb, "'NewSignature2', 'FileName2', '', '', '', '', '', '', ''");
4243 add_signature_entry(hdb, "'NewSignature3', 'FileName3', '', '', '', '', '', '', ''");
4244 add_signature_entry(hdb, "'NewSignature4', 'FileName4', '', '', '', '', '', '', ''");
4245 add_signature_entry(hdb, "'NewSignature5', 'FileName5', '', '', '', '', '', '', ''");
4246 add_signature_entry(hdb, "'NewSignature10', 'FileName8.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
4247 add_signature_entry(hdb, "'NewSignature11', 'FileName9.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
4248 add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
4249
4250 r = package_from_db(hdb, &hpkg);
4252 {
4253 skip("Not enough rights to perform tests\n");
4254 goto error;
4255 }
4256 ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
4257
4258 r = MsiSetPropertyA(hpkg, "SIGPROP8", "october");
4259 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4260
4262
4263 r = MsiDoActionA(hpkg, "AppSearch");
4264 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4265
4267 if (is_root(CURR_DIR)) expected[2] = 0;
4268
4269 size = MAX_PATH;
4270 sprintf(path, "%s\\FileName1", expected);
4271 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
4272 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4273 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
4274
4275 size = MAX_PATH;
4276 sprintf(path, "%s\\FileName2", expected);
4277 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
4278 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4279 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
4280
4281 size = MAX_PATH;
4282 sprintf(path, "%s\\FileName3", expected);
4283 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
4284 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4285 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
4286
4287 size = MAX_PATH;
4288 sprintf(path, "%s\\FileName4", expected);
4289 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
4290 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4291 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
4292
4293 size = MAX_PATH;
4294 sprintf(path, "%s\\FileName5", expected);
4295 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
4296 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4297 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
4298
4299 size = MAX_PATH;
4300 sprintf(path, "%s\\", expected);
4301 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
4302 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4303 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
4304
4305 size = MAX_PATH;
4306 sprintf(path, "%s\\", expected);
4307 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
4308 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4309 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
4310
4311 size = MAX_PATH;
4312 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
4313 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4314 ok(!lstrcmpA(prop, "october"), "Expected \"october\", got \"%s\"\n", prop);
4315
4316 size = MAX_PATH;
4317 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
4318 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4319 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
4320
4321 size = MAX_PATH;
4322 sprintf(path, "%s\\FileName8.dll", expected);
4323 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
4324 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4325 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
4326
4327 size = MAX_PATH;
4328 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
4329 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4330 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
4331
4332 size = MAX_PATH;
4333 sprintf(path, "%s\\FileName10.dll", expected);
4334 r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
4335 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4336 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
4337
4338 delete_component_path("{A8AE6692-96BA-4198-8399-145D7D1D0D0E}",
4340 delete_component_path("{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}",
4342 delete_component_path("{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}",
4344 delete_component_path("{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}",
4346 delete_component_path("{C0ECD96F-7898-4410-9667-194BD8C1B648}",
4348 delete_component_path("{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}",
4350 delete_component_path("{91B7359B-07F2-4221-AA8D-DE102BB87A5F}",
4352 delete_component_path("{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}",
4354 delete_component_path("{A204DF48-7346-4635-BA2E-66247DBAC9DF}",
4356 delete_component_path("{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}",
4358
4359 MsiCloseHandle(hpkg);
4360
4361error:
4362 DeleteFileA("FileName1");
4363 DeleteFileA("FileName2");
4364 DeleteFileA("FileName3");
4365 DeleteFileA("FileName4");
4366 DeleteFileA("FileName5");
4367 DeleteFileA("FileName6");
4368 DeleteFileA("FileName7");
4369 DeleteFileA("FileName8.dll");
4370 DeleteFileA("FileName9.dll");
4371 DeleteFileA("FileName10.dll");
4373 LocalFree(usersid);
4374}
UINT WINAPI MsiSetPropertyA(MSIHANDLE hInstall, LPCSTR szName, LPCSTR szValue)
Definition: package.c:2067
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
#define error(str)
Definition: mkdosfs.c:1605
static UINT create_complocator_table(MSIHANDLE hdb)
Definition: package.c:622
static void delete_component_path(LPCSTR guid, MSIINSTALLCONTEXT context, LPSTR usersid)
Definition: package.c:329
static char * get_user_sid(void)
Definition: package.c:126
#define add_complocator_entry(hdb, values)
Definition: package.c:825
static BOOL create_file_with_version(const CHAR *name, LONG ms, LONG ls)
Definition: package.c:1012
static void set_component_path(LPCSTR filename, MSIINSTALLCONTEXT context, LPCSTR guid, LPSTR usersid, BOOL dir)
Definition: package.c:263
static BOOL is_root(const char *path)
Definition: package.c:1081
static BOOL is_process_limited(void)
Definition: package.c:71
static void create_test_file(const CHAR *name)
Definition: package.c:992
#define MAKELONG(a, b)
Definition: typedefs.h:249
char * LPSTR
Definition: xmlstorage.h:182

Referenced by START_TEST().

◆ test_appsearch_drlocator()

static void test_appsearch_drlocator ( void  )
static

Definition at line 5195 of file package.c.

5196{
5197 MSIHANDLE hpkg, hdb;
5198 char path[MAX_PATH + 27], expected[MAX_PATH], prop[MAX_PATH];
5199 BOOL version;
5200 DWORD size;
5201 UINT r;
5202
5203 version = TRUE;
5204 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
5205 version = FALSE;
5206
5207 DeleteFileA("test.dll");
5208
5209 create_test_file("FileName1");
5210 CreateDirectoryA("one", NULL);
5211 CreateDirectoryA("one\\two", NULL);
5212 CreateDirectoryA("one\\two\\three", NULL);
5213 create_test_file("one\\two\\three\\FileName2");
5214 CreateDirectoryA("another", NULL);
5215 create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
5216 create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
5217 create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
5218
5219 hdb = create_package_db();
5220 ok(hdb, "Expected a valid database handle\n");
5221
5223 add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
5224 add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
5225 add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
5226 add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
5227 add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
5228 add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
5229 add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
5230 add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
5231 add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
5232 add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
5233 add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
5234 add_appsearch_entry(hdb, "'SIGPROP13', 'NewSignature13'");
5235
5237
5239 if (is_root(CURR_DIR)) expected[2] = 0;
5240
5241 /* no parent, full path, depth 0, signature */
5242 sprintf(path, "'NewSignature1', '', '%s', 0", expected);
5244
5245 /* no parent, full path, depth 0, no signature */
5246 sprintf(path, "'NewSignature2', '', '%s', 0", expected);
5248
5249 /* no parent, relative path, depth 0, no signature */
5250 sprintf(path, "'NewSignature3', '', '%s', 0", expected + 3);
5252
5253 /* no parent, full path, depth 2, signature */
5254 sprintf(path, "'NewSignature4', '', '%s', 2", expected);
5256
5257 /* no parent, full path, depth 3, signature */
5258 sprintf(path, "'NewSignature5', '', '%s', 3", expected);
5260
5261 /* no parent, full path, depth 1, signature is dir */
5262 sprintf(path, "'NewSignature6', '', '%s', 1", expected);
5264
5265 /* parent is in DrLocator, relative path, depth 0, signature */
5266 sprintf(path, "'NewSignature7', 'NewSignature1', 'one\\two\\three', 1");
5268
5269 /* no parent, full path, depth 0, signature w/ version */
5270 sprintf(path, "'NewSignature8', '', '%s', 0", expected);
5272
5273 /* no parent, full path, depth 0, signature w/ version, ver > max */
5274 sprintf(path, "'NewSignature9', '', '%s', 0", expected);
5276
5277 /* no parent, full path, depth 0, signature w/ version, sig->name not ignored */
5278 sprintf(path, "'NewSignature10', '', '%s', 0", expected);
5280
5281 /* no parent, relative empty path, depth 0, no signature */
5282 sprintf(path, "'NewSignature11', '', '', 0");
5284
5286
5287 /* parent */
5288 add_reglocator_entry(hdb, "NewSignature12", 2, "htmlfile\\shell\\open\\nonexistent", "", 1);
5289
5290 /* parent is in RegLocator, no path, depth 0, no signature */
5291 sprintf(path, "'NewSignature13', 'NewSignature12', '', 0");
5293
5295 add_signature_entry(hdb, "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''");
5296 add_signature_entry(hdb, "'NewSignature4', 'FileName2', '', '', '', '', '', '', ''");
5297 add_signature_entry(hdb, "'NewSignature5', 'FileName2', '', '', '', '', '', '', ''");
5298 add_signature_entry(hdb, "'NewSignature6', 'another', '', '', '', '', '', '', ''");
5299 add_signature_entry(hdb, "'NewSignature7', 'FileName2', '', '', '', '', '', '', ''");
5300 add_signature_entry(hdb, "'NewSignature8', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
5301 add_signature_entry(hdb, "'NewSignature9', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
5302 add_signature_entry(hdb, "'NewSignature10', 'necessary', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
5303
5304 r = package_from_db(hdb, &hpkg);
5306 {
5307 skip("Not enough rights to perform tests\n");
5308 goto error;
5309 }
5310 ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
5311
5313
5314 r = MsiDoActionA(hpkg, "AppSearch");
5315 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5316
5317 size = MAX_PATH;
5318 sprintf(path, "%s\\FileName1", expected);
5319 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
5320 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5321 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
5322
5323 size = MAX_PATH;
5324 sprintf(path, "%s\\", expected);
5325 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
5326 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5327 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
5328
5329 size = MAX_PATH;
5331 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
5332 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5333 ok(!lstrcmpiA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
5334
5335 size = MAX_PATH;
5336 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
5337 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5338 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
5339
5340 size = MAX_PATH;
5341 sprintf(path, "%s\\one\\two\\three\\FileName2", expected);
5342 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
5343 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5344 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
5345
5346 size = MAX_PATH;
5347 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
5348 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5349 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
5350
5351 size = MAX_PATH;
5352 sprintf(path, "%s\\one\\two\\three\\FileName2", expected);
5353 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
5354 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5355 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
5356
5357 if (version)
5358 {
5359 size = MAX_PATH;
5360 sprintf(path, "%s\\FileName3.dll", expected);
5361 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
5362 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5363 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
5364
5365 size = MAX_PATH;
5366 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
5367 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5368 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
5369
5370 size = MAX_PATH;
5371 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
5372 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5373 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
5374 }
5375
5376 size = MAX_PATH;
5378 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
5379 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5380 ok(!lstrcmpiA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
5381
5382 size = MAX_PATH;
5383 strcpy(path, "c:\\");
5384 r = MsiGetPropertyA(hpkg, "SIGPROP13", prop, &size);
5385 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5386 ok(!prop[0], "Expected \"\", got \"%s\"\n", prop);
5387
5388 MsiCloseHandle(hpkg);
5389
5390error:
5391 DeleteFileA("FileName1");
5392 DeleteFileA("FileName3.dll");
5393 DeleteFileA("FileName4.dll");
5394 DeleteFileA("FileName5.dll");
5395 DeleteFileA("one\\two\\three\\FileName2");
5396 RemoveDirectoryA("one\\two\\three");
5397 RemoveDirectoryA("one\\two");
5398 RemoveDirectoryA("one");
5399 RemoveDirectoryA("another");
5401}
static const WCHAR version[]
Definition: asmname.c:66
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4223
static void search_absolute_directory(LPSTR absolute, LPCSTR relative)
Definition: package.c:5165

Referenced by START_TEST().

◆ test_appsearch_inilocator()

static void test_appsearch_inilocator ( void  )
static

Definition at line 4958 of file package.c.

4959{
4960 MSIHANDLE hpkg, hdb;
4961 char path[MAX_PATH + 14], expected[MAX_PATH], prop[MAX_PATH];
4962 BOOL version;
4963 LPSTR ptr;
4964 DWORD size;
4965 UINT r;
4966
4967 version = TRUE;
4968 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
4969 version = FALSE;
4970
4971 DeleteFileA("test.dll");
4972
4973 WritePrivateProfileStringA("Section", "Key", "keydata,field2", "IniFile.ini");
4974
4976 if (is_root(CURR_DIR)) expected[2] = 0;
4977
4978 create_test_file("FileName1");
4979 sprintf(path, "%s\\FileName1", expected);
4980 WritePrivateProfileStringA("Section", "Key2", path, "IniFile.ini");
4981
4982 WritePrivateProfileStringA("Section", "Key3", expected, "IniFile.ini");
4983
4984 sprintf(path, "%s\\IDontExist", expected);
4985 WritePrivateProfileStringA("Section", "Key4", path, "IniFile.ini");
4986
4987 create_file_with_version("FileName2.dll", MAKELONG(2, 1), MAKELONG(4, 3));
4988 sprintf(path, "%s\\FileName2.dll", expected);
4989 WritePrivateProfileStringA("Section", "Key5", path, "IniFile.ini");
4990
4991 create_file_with_version("FileName3.dll", MAKELONG(1, 2), MAKELONG(3, 4));
4992 sprintf(path, "%s\\FileName3.dll", expected);
4993 WritePrivateProfileStringA("Section", "Key6", path, "IniFile.ini");
4994
4995 create_file_with_version("FileName4.dll", MAKELONG(2, 1), MAKELONG(4, 3));
4996 sprintf(path, "%s\\FileName4.dll", expected);
4997 WritePrivateProfileStringA("Section", "Key7", path, "IniFile.ini");
4998
4999 hdb = create_package_db();
5000 ok(hdb, "Expected a valid database handle\n");
5001
5003 add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
5004 add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
5005 add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
5006 add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
5007 add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
5008 add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
5009 add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
5010 add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
5011 add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
5012 add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
5013 add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
5014 add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
5015
5017
5018 /* msidbLocatorTypeRawValue, field 1 */
5019 add_inilocator_entry(hdb, "'NewSignature1', 'IniFile.ini', 'Section', 'Key', 1, 2");
5020
5021 /* msidbLocatorTypeRawValue, field 2 */
5022 add_inilocator_entry(hdb, "'NewSignature2', 'IniFile.ini', 'Section', 'Key', 2, 2");
5023
5024 /* msidbLocatorTypeRawValue, entire field */
5025 add_inilocator_entry(hdb, "'NewSignature3', 'IniFile.ini', 'Section', 'Key', 0, 2");
5026
5027 /* msidbLocatorTypeFile */
5028 add_inilocator_entry(hdb, "'NewSignature4', 'IniFile.ini', 'Section', 'Key2', 1, 1");
5029
5030 /* msidbLocatorTypeDirectory, file */
5031 add_inilocator_entry(hdb, "'NewSignature5', 'IniFile.ini', 'Section', 'Key2', 1, 0");
5032
5033 /* msidbLocatorTypeDirectory, directory */
5034 add_inilocator_entry(hdb, "'NewSignature6', 'IniFile.ini', 'Section', 'Key3', 1, 0");
5035
5036 /* msidbLocatorTypeFile, file, no signature */
5037 add_inilocator_entry(hdb, "'NewSignature7', 'IniFile.ini', 'Section', 'Key2', 1, 1");
5038
5039 /* msidbLocatorTypeFile, dir, no signature */
5040 add_inilocator_entry(hdb, "'NewSignature8', 'IniFile.ini', 'Section', 'Key3', 1, 1");
5041
5042 /* msidbLocatorTypeFile, file does not exist */
5043 add_inilocator_entry(hdb, "'NewSignature9', 'IniFile.ini', 'Section', 'Key4', 1, 1");
5044
5045 /* msidbLocatorTypeFile, signature with version */
5046 add_inilocator_entry(hdb, "'NewSignature10', 'IniFile.ini', 'Section', 'Key5', 1, 1");
5047
5048 /* msidbLocatorTypeFile, signature with version, ver > max */
5049 add_inilocator_entry(hdb, "'NewSignature11', 'IniFile.ini', 'Section', 'Key6', 1, 1");
5050
5051 /* msidbLocatorTypeFile, signature with version, sig->name ignored */
5052 add_inilocator_entry(hdb, "'NewSignature12', 'IniFile.ini', 'Section', 'Key7', 1, 1");
5053
5055 add_signature_entry(hdb, "'NewSignature4', 'FileName1', '', '', '', '', '', '', ''");
5056 add_signature_entry(hdb, "'NewSignature9', 'IDontExist', '', '', '', '', '', '', ''");
5057 add_signature_entry(hdb, "'NewSignature10', 'FileName2.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
5058 add_signature_entry(hdb, "'NewSignature11', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
5059 add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
5060
5061 r = package_from_db(hdb, &hpkg);
5063 {
5064 skip("Not enough rights to perform tests\n");
5065 goto error;
5066 }
5067 ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
5068
5070
5071 r = MsiDoActionA(hpkg, "AppSearch");
5072 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5073
5074 size = MAX_PATH;
5075 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
5076 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5077 ok(!lstrcmpA(prop, "keydata"), "Expected \"keydata\", got \"%s\"\n", prop);
5078
5079 size = MAX_PATH;
5080 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
5081 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5082 ok(!lstrcmpA(prop, "field2"), "Expected \"field2\", got \"%s\"\n", prop);
5083
5084 size = MAX_PATH;
5085 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
5086 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5087 ok(!lstrcmpA(prop, "keydata,field2"),
5088 "Expected \"keydata,field2\", got \"%s\"\n", prop);
5089
5090 size = MAX_PATH;
5091 sprintf(path, "%s\\FileName1", expected);
5092 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
5093 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5094 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
5095
5096 size = MAX_PATH;
5097 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
5098 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5099 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
5100
5101 size = MAX_PATH;
5102 sprintf(path, "%s\\", expected);
5103 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
5104 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5105 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
5106
5107 size = MAX_PATH;
5108 sprintf(path, "%s\\", expected);
5109 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
5110 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5111 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
5112
5113 if (!is_root(CURR_DIR))
5114 {
5115 size = MAX_PATH;
5117 ptr = strrchr(path, '\\');
5118 *(ptr + 1) = 0;
5119 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
5120 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5121 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
5122 }
5123 size = MAX_PATH;
5124 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
5125 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5126 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
5127
5128 if (version)
5129 {
5130 size = MAX_PATH;
5131 sprintf(path, "%s\\FileName2.dll", expected);
5132 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
5133 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5134 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
5135
5136 size = MAX_PATH;
5137 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
5138 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5139 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
5140
5141 size = MAX_PATH;
5142 sprintf(path, "%s\\FileName4.dll", expected);
5143 r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
5144 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5145 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
5146 }
5147
5148 MsiCloseHandle(hpkg);
5149
5150error:
5151 delete_win_ini("IniFile.ini");
5152 DeleteFileA("FileName1");
5153 DeleteFileA("FileName2.dll");
5154 DeleteFileA("FileName3.dll");
5155 DeleteFileA("FileName4.dll");
5157}
BOOL WINAPI DECLSPEC_HOTPATCH WritePrivateProfileStringA(LPCSTR section, LPCSTR entry, LPCSTR string, LPCSTR filename)
Definition: profile.c:1484
static PVOID ptr
Definition: dispmode.c:27
static UINT create_inilocator_table(MSIHANDLE hdb)
Definition: package.c:634
#define add_inilocator_entry(hdb, values)
Definition: package.c:829
static void delete_win_ini(LPCSTR file)
Definition: package.c:4947
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)

Referenced by START_TEST().

◆ test_appsearch_reglocator()

static void test_appsearch_reglocator ( void  )
static

Definition at line 4376 of file package.c.

4377{
4378 MSIHANDLE hpkg, hdb;
4379 char path[MAX_PATH + 20], expected[MAX_PATH], prop[MAX_PATH];
4380 DWORD binary[2], size, val;
4381 BOOL space, version, is_64bit = sizeof(void *) > sizeof(int);
4382 HKEY hklm, classes, hkcu, users;
4383 LPSTR pathdata, pathvar, ptr;
4384 LONG res;
4385 UINT r, type = 0;
4386 SYSTEM_INFO si;
4387
4388 version = TRUE;
4389 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
4390 version = FALSE;
4391
4392 DeleteFileA("test.dll");
4393
4394 res = RegCreateKeyA(HKEY_CLASSES_ROOT, "Software\\Wine", &classes);
4395 if (res == ERROR_ACCESS_DENIED)
4396 {
4397 skip("Not enough rights to perform tests\n");
4398 return;
4399 }
4400 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4401
4402 res = RegSetValueExA(classes, "Value1", 0, REG_SZ,
4403 (const BYTE *)"regszdata", 10);
4404 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4405
4406 res = RegCreateKeyA(HKEY_CURRENT_USER, "Software\\Wine", &hkcu);
4407 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4408
4409 res = RegSetValueExA(hkcu, "Value1", 0, REG_SZ,
4410 (const BYTE *)"regszdata", 10);
4411 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4412
4413 users = 0;
4414 res = RegCreateKeyA(HKEY_USERS, "S-1-5-18\\Software\\Wine", &users);
4415 ok(res == ERROR_SUCCESS ||
4417 "Expected ERROR_SUCCESS, got %ld\n", res);
4418
4419 if (res == ERROR_SUCCESS)
4420 {
4421 res = RegSetValueExA(users, "Value1", 0, REG_SZ,
4422 (const BYTE *)"regszdata", 10);
4423 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4424 }
4425
4426 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine", &hklm);
4427 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4428
4429 res = RegSetValueA(hklm, NULL, REG_SZ, "defvalue", 8);
4430 ok(