ReactOS 0.4.16-dev-588-gf07ea94
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 "utils.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 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 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 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_test_file (const CHAR *name)
 
static BOOL create_file_with_version (const CHAR *name, LONG ms, LONG ls)
 
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, int todo_value)
 
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 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:639

Definition at line 744 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 676 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 712 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 719 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 653 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 736 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 740 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 728 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 732 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 658 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 715 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 667 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 662 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 671 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 723 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 699 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 703 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 686 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 707 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 690 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 680 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 748 of file package.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 22 of file package.c.

◆ ok_sequence

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

Definition at line 8765 of file package.c.

◆ roundoffs

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

Definition at line 887 of file package.c.

◆ roundpos

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

Definition at line 888 of file package.c.

◆ test_file_access

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

Definition at line 7608 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 696 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 693 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 7565 of file package.c.

7566{
7567 DWORD access = 0, share = 0;
7568 DWORD lasterr;
7569 HANDLE hfile;
7570 int i, j, idx = 0;
7571
7572 for (i = 0; i < 4; i++)
7573 {
7574 if (i == 0) access = 0;
7575 if (i == 1) access = GENERIC_READ;
7576 if (i == 2) access = GENERIC_WRITE;
7577 if (i == 3) access = GENERIC_READ | GENERIC_WRITE;
7578
7579 for (j = 0; j < 4; j++)
7580 {
7581 if (ares[idx].ignore)
7582 continue;
7583
7584 if (j == 0) share = 0;
7585 if (j == 1) share = FILE_SHARE_READ;
7586 if (j == 2) share = FILE_SHARE_WRITE;
7587 if (j == 3) share = FILE_SHARE_READ | FILE_SHARE_WRITE;
7588
7589 SetLastError(0xdeadbeef);
7590 hfile = CreateFileA(file, access, share, NULL, OPEN_EXISTING,
7592 lasterr = GetLastError();
7593
7594 ok((hfile != INVALID_HANDLE_VALUE) == ares[idx].gothandle,
7595 "(%lu, handle, %d): Expected %d, got %d\n",
7596 line, idx, ares[idx].gothandle,
7597 (hfile != INVALID_HANDLE_VALUE));
7598
7599 ok(lasterr == ares[idx].lasterr, "(%lu, lasterr, %u): Expected %lu, got %lu\n",
7600 line, idx, ares[idx].lasterr, lasterr);
7601
7602 CloseHandle(hfile);
7603 idx++;
7604 }
7605 }
7606}
#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 639 of file package.c.

640{
641 char *query;
642 UINT sz, r;
643
644 sz = strlen(values) + strlen(insert) + 1;
645 query = malloc(sz);
647 r = run_query(hdb, 0, query);
648 free(query);
649 ok_(file, line)(r == ERROR_SUCCESS, "failed to insert into %s table: %u\n", type, r);
650 return r;
651}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define ok_(x1, x2)
Definition: atltest.h:61
static int run_query(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name, BOOL value_empty, BOOL recurse)
Definition: query.c:311
#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
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 8668 of file package.c.

8669{
8670 if (!sequence)
8671 {
8672 sequence_size = 10;
8673 sequence = malloc(sequence_size * sizeof(*sequence));
8674 }
8676 {
8677 sequence_size *= 2;
8679 }
8680
8683}
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:8666
static int sequence_count
Definition: package.c:8666

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

754{
755 const char insert[] =
756 "INSERT INTO `RegLocator` (`Signature_`, `Root`, `Key`, `Name`, `Type`) "
757 "VALUES( '%s', %u, '%s', '%s', %u )";
758 char *query;
759 UINT sz, r;
760
761 sz = strlen( sig ) + 10 + strlen( path ) + strlen( name ) + 10 + sizeof( insert );
762 query = malloc( sz );
763 sprintf( query, insert, sig, root, path, name, type );
764 r = run_query( hdb, 0, query );
765 free( query );
766 ok(r == ERROR_SUCCESS, "failed to insert into reglocator table: %u\n", r); \
767 return r;
768}
Definition: name.c:39

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

◆ check_prop()

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

Definition at line 1993 of file package.c.

1994{
1995 char buffer[MAX_PATH] = "x";
1996 DWORD sz = sizeof(buffer);
1997 UINT r = MsiGetPropertyA(hpkg, prop, buffer, &sz);
1998 ok(!r, "'%s': got %u\n", prop, r);
1999 ok(sz == lstrlenA(buffer), "'%s': expected %u, got %lu\n", prop, lstrlenA(buffer), sz);
2000 if (match_case)
2001 todo_wine_if (todo_value) ok(!strcmp(buffer, expect), "'%s': expected '%s', got '%s'\n", prop, expect, buffer);
2002 else
2003 todo_wine_if (todo_value) ok(!_stricmp(buffer, expect), "'%s': expected '%s', got '%s'\n", prop, expect, buffer);
2004}
#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
#define todo_wine_if(is_todo)
Definition: custom.c:86

Referenced by test_installprops(), and test_props().

◆ create_actiontext_table()

static UINT create_actiontext_table ( MSIHANDLE  hdb)
static

Definition at line 611 of file package.c.

612{
613 UINT r = run_query(hdb, 0,
614 "CREATE TABLE `ActionText` ("
615 "`Action` CHAR(72) NOT NULL, "
616 "`Description` CHAR(64) LOCALIZABLE, "
617 "`Template` CHAR(128) LOCALIZABLE "
618 "PRIMARY KEY `Action`)");
619 ok(r == ERROR_SUCCESS, "Failed to create ActionText table: %u\n", r);
620 return r;
621}

Referenced by test_externalui_message().

◆ create_appsearch_table()

static UINT create_appsearch_table ( MSIHANDLE  hdb)
static

Definition at line 389 of file package.c.

390{
391 UINT r = run_query( hdb, 0,
392 "CREATE TABLE `AppSearch` ("
393 "`Property` CHAR(72) NOT NULL, "
394 "`Signature_` CHAR(72) NOT NULL "
395 "PRIMARY KEY `Property`, `Signature_`)" );
396 ok(r == ERROR_SUCCESS, "Failed to create AppSearch table: %u\n", r);
397 return r;
398}

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

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

Referenced by test_ccpsearch().

◆ create_complocator_table()

static UINT create_complocator_table ( MSIHANDLE  hdb)
static

Definition at line 516 of file package.c.

517{
518 UINT r = run_query( hdb, 0,
519 "CREATE TABLE `CompLocator` ("
520 "`Signature_` CHAR(72) NOT NULL, "
521 "`ComponentId` CHAR(38) NOT NULL, "
522 "`Type` SHORT "
523 "PRIMARY KEY `Signature_`)" );
524 ok(r == ERROR_SUCCESS, "Failed to create CompLocator table: %u\n", r);
525 return r;
526}

Referenced by test_appsearch_complocator(), and test_complocator().

◆ create_component_table()

static UINT create_component_table ( MSIHANDLE  hdb)
static

Definition at line 315 of file package.c.

316{
317 UINT r = run_query( hdb, 0,
318 "CREATE TABLE `Component` ( "
319 "`Component` CHAR(72) NOT NULL, "
320 "`ComponentId` CHAR(38), "
321 "`Directory_` CHAR(72) NOT NULL, "
322 "`Attributes` SHORT NOT NULL, "
323 "`Condition` CHAR(255), "
324 "`KeyPath` CHAR(72) "
325 "PRIMARY KEY `Component`)" );
326 ok(r == ERROR_SUCCESS, "Failed to create Component table: %u\n", r);
327 return r;
328}

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

576{
577 UINT r = run_query(hdb, 0,
578 "CREATE TABLE `Control` ("
579 "`Dialog_` CHAR(72) NOT NULL, "
580 "`Control` CHAR(50) NOT NULL, "
581 "`Type` CHAR(20) NOT NULL, "
582 "`X` SHORT NOT NULL, "
583 "`Y` SHORT NOT NULL, "
584 "`Width` SHORT NOT NULL, "
585 "`Height` SHORT NOT NULL, "
586 "`Attributes` LONG, "
587 "`Property` CHAR(50), "
588 "`Text` CHAR(0) LOCALIZABLE, "
589 "`Control_Next` CHAR(50), "
590 "`Help` CHAR(255) LOCALIZABLE "
591 "PRIMARY KEY `Dialog_`, `Control`)");
592 ok(r == ERROR_SUCCESS, "Failed to create Control table: %u\n", r);
593 return r;
594}

Referenced by test_controlevent(), and test_externalui_message().

◆ create_controlevent_table()

static UINT create_controlevent_table ( MSIHANDLE  hdb)
static

Definition at line 596 of file package.c.

597{
598 UINT r = run_query(hdb, 0,
599 "CREATE TABLE `ControlEvent` ("
600 "`Dialog_` CHAR(72) NOT NULL, "
601 "`Control_` CHAR(50) NOT NULL, "
602 "`Event` CHAR(50) NOT NULL, "
603 "`Argument` CHAR(255) NOT NULL, "
604 "`Condition` CHAR(255), "
605 "`Ordering` SHORT "
606 "PRIMARY KEY `Dialog_`, `Control_`, `Event`, `Argument`, `Condition`)");
607 ok(r == ERROR_SUCCESS, "Failed to create ControlEvent table: %u\n", r);
608 return r;
609}

Referenced by test_controlevent().

◆ create_custom_action_table()

static UINT create_custom_action_table ( MSIHANDLE  hdb)
static

Definition at line 543 of file package.c.

544{
545 UINT r = run_query( hdb, 0,
546 "CREATE TABLE `CustomAction` ("
547 "`Action` CHAR(72) NOT NULL, "
548 "`Type` SHORT NOT NULL, "
549 "`Source` CHAR(75), "
550 "`Target` CHAR(255) "
551 "PRIMARY KEY `Action`)" );
552 ok(r == ERROR_SUCCESS, "Failed to create CustomAction table: %u\n", r);
553 return r;
554}

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

557{
558 UINT r = run_query(hdb, 0,
559 "CREATE TABLE `Dialog` ("
560 "`Dialog` CHAR(72) NOT NULL, "
561 "`HCentering` SHORT NOT NULL, "
562 "`VCentering` SHORT NOT NULL, "
563 "`Width` SHORT NOT NULL, "
564 "`Height` SHORT NOT NULL, "
565 "`Attributes` LONG, "
566 "`Title` CHAR(128) LOCALIZABLE, "
567 "`Control_First` CHAR(50) NOT NULL, "
568 "`Control_Default` CHAR(50), "
569 "`Control_Cancel` CHAR(50) "
570 "PRIMARY KEY `Dialog`)");
571 ok(r == ERROR_SUCCESS, "Failed to create Dialog table: %u\n", r);
572 return r;
573}

Referenced by test_controlevent(), and test_externalui_message().

◆ create_drlocator_table()

static UINT create_drlocator_table ( MSIHANDLE  hdb)
static

Definition at line 503 of file package.c.

504{
505 UINT r = run_query( hdb, 0,
506 "CREATE TABLE `DrLocator` ("
507 "`Signature_` CHAR(72) NOT NULL, "
508 "`Parent` CHAR(72), "
509 "`Path` CHAR(255), "
510 "`Depth` SHORT "
511 "PRIMARY KEY `Signature_`, `Parent`, `Path`)" );
512 ok(r == ERROR_SUCCESS, "Failed to create DrLocator table: %u\n", r);
513 return r;
514}

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

348{
349 UINT r = run_query( hdb, 0,
350 "CREATE TABLE `FeatureComponents` ( "
351 "`Feature_` CHAR(38) NOT NULL, "
352 "`Component_` CHAR(72) NOT NULL "
353 "PRIMARY KEY `Feature_`, `Component_` )" );
354 ok(r == ERROR_SUCCESS, "Failed to create FeatureComponents table: %u\n", r);
355 return r;
356}

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

331{
332 UINT r = run_query( hdb, 0,
333 "CREATE TABLE `Feature` ( "
334 "`Feature` CHAR(38) NOT NULL, "
335 "`Feature_Parent` CHAR(38), "
336 "`Title` CHAR(64), "
337 "`Description` CHAR(255), "
338 "`Display` SHORT NOT NULL, "
339 "`Level` SHORT NOT NULL, "
340 "`Directory_` CHAR(72), "
341 "`Attributes` SHORT NOT NULL "
342 "PRIMARY KEY `Feature`)" );
343 ok(r == ERROR_SUCCESS, "Failed to create Feature table: %u\n", r);
344 return r;
345}

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

◆ create_file_table()

static UINT create_file_table ( MSIHANDLE  hdb)
static

Definition at line 358 of file package.c.

359{
360 UINT r = run_query( hdb, 0,
361 "CREATE TABLE `File` ("
362 "`File` CHAR(72) NOT NULL, "
363 "`Component_` CHAR(72) NOT NULL, "
364 "`FileName` CHAR(255) NOT NULL, "
365 "`FileSize` LONG NOT NULL, "
366 "`Version` CHAR(72), "
367 "`Language` CHAR(20), "
368 "`Attributes` SHORT, "
369 "`Sequence` SHORT NOT NULL "
370 "PRIMARY KEY `File`)" );
371 ok(r == ERROR_SUCCESS, "Failed to create File table: %u\n", r);
372 return r;
373}

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

891{
892 VS_VERSIONINFO *pVerInfo;
893 VS_FIXEDFILEINFO *pFixedInfo;
894 LPBYTE buffer, ofs;
898 BOOL ret = FALSE;
899
901 /* Some dlls can't be updated on Vista/W2K8 */
902 lstrcatA(path, "\\version.dll");
903
905
907 buffer = malloc(size);
908
910
911 pVerInfo = (VS_VERSIONINFO *)buffer;
912 ofs = (BYTE *)&pVerInfo->szKey[lstrlenW(pVerInfo->szKey) + 1];
913 pFixedInfo = (VS_FIXEDFILEINFO *)roundpos(pVerInfo, ofs, 4);
914
915 pFixedInfo->dwFileVersionMS = ms;
916 pFixedInfo->dwFileVersionLS = ls;
917 pFixedInfo->dwProductVersionMS = ms;
918 pFixedInfo->dwProductVersionLS = ls;
919
921 if (!resource)
922 goto done;
923
926 goto done;
927
929 goto done;
930
931 ret = TRUE;
932
933done:
934 free(buffer);
935 return ret;
936}
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:888
#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 528 of file package.c.

529{
530 UINT r = run_query( hdb, 0,
531 "CREATE TABLE `IniLocator` ("
532 "`Signature_` CHAR(72) NOT NULL, "
533 "`FileName` CHAR(255) NOT NULL, "
534 "`Section` CHAR(96)NOT NULL, "
535 "`Key` CHAR(128)NOT NULL, "
536 "`Field` SHORT, "
537 "`Type` SHORT "
538 "PRIMARY KEY `Signature_`)" );
539 ok(r == ERROR_SUCCESS, "Failed to create IniLocator table: %u\n", r);
540 return r;
541}

Referenced by test_appsearch_inilocator().

◆ create_install_execute_sequence_table()

static UINT create_install_execute_sequence_table ( MSIHANDLE  hdb)
static

Definition at line 454 of file package.c.

455{
456 UINT r = run_query( hdb, 0,
457 "CREATE TABLE `InstallExecuteSequence` ("
458 "`Action` CHAR(72) NOT NULL, "
459 "`Condition` CHAR(255), "
460 "`Sequence` SHORT "
461 "PRIMARY KEY `Action`)" );
462 ok(r == ERROR_SUCCESS, "Failed to create InstallExecuteSequence table: %u\n", r);
463 return r;
464}

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

467{
468 UINT r = run_query( hdb, 0,
469 "CREATE TABLE `InstallUISequence` ("
470 "`Action` CHAR(72) NOT NULL, "
471 "`Condition` CHAR(255), "
472 "`Sequence` SHORT "
473 "PRIMARY KEY `Action`)" );
474 ok(r == ERROR_SUCCESS, "Failed to create InstallUISequence table: %u\n", r);
475 return r;
476}

Referenced by test_top_level_action().

◆ create_launchcondition_table()

static UINT create_launchcondition_table ( MSIHANDLE  hdb)
static

Definition at line 432 of file package.c.

433{
434 UINT r = run_query( hdb, 0,
435 "CREATE TABLE `LaunchCondition` ("
436 "`Condition` CHAR(255) NOT NULL, "
437 "`Description` CHAR(255) NOT NULL "
438 "PRIMARY KEY `Condition`)" );
439 ok(r == ERROR_SUCCESS, "Failed to create LaunchCondition table: %u\n", r);
440 return r;
441}

Referenced by test_launchconditions().

◆ create_media_table()

static UINT create_media_table ( MSIHANDLE  hdb)
static

Definition at line 478 of file package.c.

479{
480 UINT r = run_query( hdb, 0,
481 "CREATE TABLE `Media` ("
482 "`DiskId` SHORT NOT NULL, "
483 "`LastSequence` SHORT NOT NULL, "
484 "`DiskPrompt` CHAR(64), "
485 "`Cabinet` CHAR(255), "
486 "`VolumeLabel` CHAR(32), "
487 "`Source` CHAR(72) "
488 "PRIMARY KEY `DiskId`)" );
489 ok(r == ERROR_SUCCESS, "Failed to create Media table: %u\n", r);
490 return r;
491}

Referenced by test_costs(), and test_states().

◆ create_package_db()

static MSIHANDLE create_package_db ( void  )
static

Definition at line 815 of file package.c.

816{
817 MSIHANDLE hdb = 0;
818 UINT res;
819
821
822 /* create an empty database */
824 ok( res == ERROR_SUCCESS , "Failed to create database %u\n", res );
825 if( res != ERROR_SUCCESS )
826 return hdb;
827
828 res = MsiDatabaseCommit( hdb );
829 ok( res == ERROR_SUCCESS , "Failed to commit database\n" );
830
831 res = set_summary_info(hdb);
832 ok( res == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", res);
833
834 res = run_query( hdb, 0,
835 "CREATE TABLE `Directory` ( "
836 "`Directory` CHAR(255) NOT NULL, "
837 "`Directory_Parent` CHAR(255), "
838 "`DefaultDir` CHAR(255) NOT NULL "
839 "PRIMARY KEY `Directory`)" );
840 ok( res == ERROR_SUCCESS , "Failed to create directory table\n" );
841
842 return hdb;
843}
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:39
static const char msifile[]
Definition: package.c:38
static UINT set_summary_info(MSIHANDLE hdb)
Definition: package.c:770
UINT WINAPI MsiDatabaseCommit(MSIHANDLE hdb)
Definition: msiquery.c:962
#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 443 of file package.c.

444{
445 UINT r = run_query( hdb, 0,
446 "CREATE TABLE `Property` ("
447 "`Property` CHAR(72) NOT NULL, "
448 "`Value` CHAR(0) "
449 "PRIMARY KEY `Property`)" );
450 ok(r == ERROR_SUCCESS, "Failed to create Property table: %u\n", r);
451 return r;
452}

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

401{
402 UINT r = run_query( hdb, 0,
403 "CREATE TABLE `RegLocator` ("
404 "`Signature_` CHAR(72) NOT NULL, "
405 "`Root` SHORT NOT NULL, "
406 "`Key` CHAR(255) NOT NULL, "
407 "`Name` CHAR(255), "
408 "`Type` SHORT "
409 "PRIMARY KEY `Signature_`)" );
410 ok(r == ERROR_SUCCESS, "Failed to create RegLocator table: %u\n", r);
411 return r;
412}

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

376{
377 UINT r = run_query( hdb, 0,
378 "CREATE TABLE `RemoveFile` ("
379 "`FileKey` CHAR(72) NOT NULL, "
380 "`Component_` CHAR(72) NOT NULL, "
381 "`FileName` CHAR(255) LOCALIZABLE, "
382 "`DirProperty` CHAR(72) NOT NULL, "
383 "`InstallMode` SHORT NOT NULL "
384 "PRIMARY KEY `FileKey`)" );
385 ok(r == ERROR_SUCCESS, "Failed to create RemoveFile table: %u\n", r);
386 return r;
387}

Referenced by test_removefiles().

◆ create_signature_table()

static UINT create_signature_table ( MSIHANDLE  hdb)
static

Definition at line 414 of file package.c.

415{
416 UINT r = run_query( hdb, 0,
417 "CREATE TABLE `Signature` ("
418 "`Signature` CHAR(72) NOT NULL, "
419 "`FileName` CHAR(255) NOT NULL, "
420 "`MinVersion` CHAR(20), "
421 "`MaxVersion` CHAR(20), "
422 "`MinSize` LONG, "
423 "`MaxSize` LONG, "
424 "`MinDate` LONG, "
425 "`MaxDate` LONG, "
426 "`Languages` CHAR(255) "
427 "PRIMARY KEY `Signature`)" );
428 ok(r == ERROR_SUCCESS, "Failed to create Signature table: %u\n", r);
429 return r;
430}

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

◆ create_test_file()

static void create_test_file ( const CHAR name)
static

Definition at line 870 of file package.c.

871{
873}
static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
Definition: asmcache.c:795

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

◆ create_test_guid()

static void create_test_guid ( LPSTR  prodcode,
LPSTR  squashed 
)
static

Definition at line 154 of file package.c.

155{
156 WCHAR guidW[MAX_PATH];
157 WCHAR squashedW[MAX_PATH];
158 GUID guid;
159 HRESULT hr;
160 int size;
161
162 hr = CoCreateGuid(&guid);
163 ok(hr == S_OK, "Expected S_OK, got %#lx\n", hr);
164
165 size = StringFromGUID2(&guid, guidW, MAX_PATH);
166 ok(size == 39, "Expected 39, got %#lx\n", hr);
167
168 WideCharToMultiByte(CP_ACP, 0, guidW, size, prodcode, MAX_PATH, NULL, NULL);
169 squash_guid(guidW, squashedW);
170 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
171}
#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:122
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 623 of file package.c.

624{
625 UINT r = run_query( hdb, 0,
626 "CREATE TABLE `Upgrade` ("
627 "`UpgradeCode` CHAR(38) NOT NULL, "
628 "`VersionMin` CHAR(20), "
629 "`VersionMax` CHAR(20), "
630 "`Language` CHAR(255), "
631 "`Attributes` SHORT, "
632 "`Remove` CHAR(255), "
633 "`ActionProperty` CHAR(72) NOT NULL "
634 "PRIMARY KEY `UpgradeCode`, `VersionMin`, `VersionMax`, `Language`)" );
635 ok(r == ERROR_SUCCESS, "Failed to create Upgrade table: %u\n", r);
636 return r;
637}

Referenced by test_states().

◆ delete_component_path()

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

Definition at line 239 of file package.c.

240{
241 WCHAR guidW[MAX_PATH];
242 WCHAR squashedW[MAX_PATH];
244 CHAR squashed[MAX_PATH];
245 CHAR comppath[MAX_PATH + 81];
246 CHAR prodpath[MAX_PATH];
248
249 if (is_wow64)
251
252 MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
253 squash_guid(guidW, squashedW);
254 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
255
257 {
258 sprintf(comppath,
259 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
260 "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed);
261 lstrcpyA(prodpath,
262 "SOFTWARE\\Classes\\Installer\\"
263 "Products\\3D0DAE300FACA1300AD792060BCDAA92");
264 }
266 {
267 sprintf(comppath,
268 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
269 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
270 sprintf(prodpath,
271 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
272 "Installer\\%s\\Installer\\Products\\"
273 "7D2F387510109040002000060BECB6AB", usersid);
274 }
276 {
277 sprintf(comppath,
278 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
279 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
280 sprintf(prodpath,
281 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
282 "Installer\\Managed\\%s\\Installer\\Products\\"
283 "7D2F387510109040002000060BECB6AB", usersid);
284 }
285
286 MultiByteToWideChar(CP_ACP, 0, comppath, -1, substrW, MAX_PATH);
288
289 MultiByteToWideChar(CP_ACP, 0, prodpath, -1, substrW, MAX_PATH);
291}
#define MultiByteToWideChar
Definition: compat.h:110
static const WCHAR substrW[]
Definition: string.c:60
BOOL is_wow64
Definition: msi.c:52
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
static LSTATUS package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey, REGSAM access)
Definition: package.c:61
@ 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_win_ini()

static void delete_win_ini ( LPCSTR  file)
static

Definition at line 4795 of file package.c.

4796{
4798
4800 lstrcatA(path, "\\");
4801 lstrcatA(path, file);
4802
4804}
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 293 of file package.c.

294{
295 MSIHANDLE hview = 0;
296 UINT r, ret;
297
298 /* open a select query */
299 r = MsiDatabaseOpenViewA(hdb, query, &hview);
300 if (r != ERROR_SUCCESS)
301 return r;
302 r = MsiViewExecute(hview, 0);
303 if (r != ERROR_SUCCESS)
304 return r;
305 ret = MsiViewFetch(hview, phrec);
306 r = MsiViewClose(hview);
307 if (r != ERROR_SUCCESS)
308 return r;
309 r = MsiCloseHandle(hview);
310 if (r != ERROR_SUCCESS)
311 return r;
312 return ret;
313}
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 8562 of file package.c.

8563{
8564 externalui_ran = 1;
8565 ok(message_type == INSTALLMESSAGE_USER, "expected INSTALLMESSAGE_USER, got %08x\n", message_type);
8566 return 0;
8567}
static int externalui_ran
Definition: package.c:8560
@ 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 8925 of file package.c.

8926{
8927 INT retval = context ? *((INT *)context) : 0;
8928 struct externalui_message msg;
8929 char buffer[256];
8930 DWORD length;
8931 UINT r;
8932 int i;
8933
8934 msg.message = message;
8936 {
8937 /* trying to access the record seems to hang on some versions of Windows */
8938 msg.field_count = -1;
8939 add_message(&msg);
8940 return 1;
8941 }
8942 msg.field_count = MsiRecordGetFieldCount(hrecord);
8943 for (i = 0; i <= msg.field_count; i++)
8944 {
8945 length = sizeof(buffer);
8946 r = MsiRecordGetStringA(hrecord, i, buffer, &length);
8947 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
8948 memcpy(msg.field[i], buffer, min(100, length+1));
8949 }
8950
8951 /* top-level actions dump a list of all set properties; skip them since they're inconsistent */
8952 if (message == (INSTALLMESSAGE_INFO|MB_ICONHAND) && msg.field_count > 0 && !strncmp(msg.field[0], "Property", 8))
8953 return retval;
8954
8955 add_message(&msg);
8956
8957 return retval;
8958}
#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
int retval
Definition: wcstombs.cpp:91
#define MB_ICONHAND
Definition: winuser.h:791

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

8913{
8914 INT retval = context ? *((INT *)context) : 0;
8915 struct externalui_message msg;
8916
8917 msg.message = message;
8918 msg.field_count = 0;
8919 strcpy(msg.field[0], string);
8920 add_message(&msg);
8921
8922 return retval;
8923}
strcpy
Definition: string.h:131

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

8572{
8573 INT retval = context ? *((INT *)context) : 0;
8574 UINT r;
8576 ok(message_type == INSTALLMESSAGE_USER, "expected INSTALLMESSAGE_USER, got %08x\n", message_type);
8577 r = MsiRecordGetFieldCount(hrecord);
8578 ok(r == 1, "expected 1, got %u\n", r);
8579 r = MsiRecordGetInteger(hrecord, 1);
8580 ok(r == 12345, "expected 12345, got %u\n", r);
8581 return retval;
8582}
int WINAPI MsiRecordGetInteger(MSIHANDLE handle, UINT iField)
Definition: record.c:237
static int externalui_record_ran
Definition: package.c:8569

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

2183{
2184 MSIHANDLE hview, hrec;
2185 BOOL found = FALSE;
2187 DWORD sz;
2188 UINT r;
2189
2190 r = MsiDatabaseOpenViewA(hdb, "SELECT * FROM `_Property`", &hview);
2191 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
2192 r = MsiViewExecute(hview, 0);
2193 ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n");
2194
2195 if (len < 0) len = lstrlenA(val);
2196
2197 while (r == ERROR_SUCCESS && !found)
2198 {
2199 r = MsiViewFetch(hview, &hrec);
2200 if (r != ERROR_SUCCESS) break;
2201
2202 sz = MAX_PATH;
2203 r = MsiRecordGetStringA(hrec, 1, buffer, &sz);
2204 if (r == ERROR_SUCCESS && !lstrcmpA(buffer, prop))
2205 {
2206 sz = MAX_PATH;
2207 r = MsiRecordGetStringA(hrec, 2, buffer, &sz);
2208 if (r == ERROR_SUCCESS && !memcmp(buffer, val, len) && !buffer[len])
2209 {
2210 ok(sz == len, "wrong size %lu\n", sz);
2211 found = TRUE;
2212 }
2213 }
2214
2215 MsiCloseHandle(hrec);
2216 }
2217 MsiViewClose(hview);
2218 MsiCloseHandle(hview);
2219 return found;
2220}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4195
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 8685 of file package.c.

8686{
8687 free(sequence);
8688 sequence = NULL;
8690}

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

42{
44 DWORD size = 0;
46 char *usersid = NULL;
47
50
51 user = malloc(size);
53 ConvertSidToStringSidA(user->User.Sid, &usersid);
54 free(user);
55
57 return usersid;
58}
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().

◆ is_root()

static BOOL is_root ( const char path)
static

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

8694{
8695 static const struct externalui_message end_of_sequence = {0};
8696 const struct externalui_message *actual;
8697 int failcount = 0;
8698 int i;
8699
8700 add_message(&end_of_sequence);
8701
8702 actual = sequence;
8703
8704 while (expected->message && actual->message)
8705 {
8706 if (expected->message == actual->message)
8707 {
8708 if (expected->field_count < actual->field_count)
8709 {
8711 ok_(file, line) (FALSE, "%s: in msg 0x%08x expecting field count %d got %d\n",
8712 context, expected->message, expected->field_count, actual->field_count);
8713 failcount++;
8714 }
8715
8716 for (i = 0; i <= actual->field_count; i++)
8717 {
8718 if (expected->match[i] && strcmp(expected->field[i], actual->field[i]))
8719 {
8721 ok_(file, line) (FALSE, "%s: in msg 0x%08x field %d: expected \"%s\", got \"%s\"\n",
8722 context, expected->message, i, expected->field[i], actual->field[i]);
8723 failcount++;
8724 }
8725 }
8726
8727 expected++;
8728 actual++;
8729 }
8730 else if (expected->optional)
8731 {
8732 expected++;
8733 }
8734 else
8735 {
8737 ok_(file, line) (FALSE, "%s: the msg 0x%08x was expected, but got msg 0x%08x instead\n",
8738 context, expected->message, actual->message);
8739 failcount++;
8740 if (todo)
8741 goto done;
8742 expected++;
8743 actual++;
8744 }
8745 }
8746
8747 if (expected->message || actual->message)
8748 {
8750 ok_(file, line) (FALSE, "%s: the msg sequence is not complete: expected %08x - actual %08x\n",
8751 context, expected->message, actual->message);
8752 failcount++;
8753 }
8754
8755 if(todo && !failcount) /* succeeded yet marked todo */
8756 {
8757 todo_wine
8758 ok_(file, line)(TRUE, "%s: marked \"todo_wine\" but succeeds\n", context);
8759 }
8760
8761done:
8763}
BOOL todo
Definition: filedlg.c:313
BOOL expected
Definition: store.c:2063
#define todo_wine
Definition: custom.c:89
static void flush_sequence(void)
Definition: package.c:8685
char field[4][100]
Definition: package.c:8660

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

62{
63 LONG ret;
64 DWORD dwMaxSubkeyLen, dwMaxValueLen;
65 DWORD dwMaxLen, dwSize;
66 WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf;
67 HKEY hSubKey = hKey;
68
69 if(lpszSubKey)
70 {
71 ret = RegOpenKeyExW(hKey, lpszSubKey, 0, access, &hSubKey);
72 if (ret) return ret;
73 }
74
75 ret = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL,
76 &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
77 if (ret) goto cleanup;
78
79 dwMaxSubkeyLen++;
80 dwMaxValueLen++;
81 dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
82 if (dwMaxLen > ARRAY_SIZE(szNameBuf))
83 {
84 /* Name too big: alloc a buffer for it */
85 if (!(lpszName = malloc(dwMaxLen * sizeof(WCHAR))))
86 {
88 goto cleanup;
89 }
90 }
91
92 /* Recursively delete all the subkeys */
93 while (TRUE)
94 {
95 dwSize = dwMaxLen;
96 if (RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL,
97 NULL, NULL, NULL)) break;
98
99 ret = package_RegDeleteTreeW(hSubKey, lpszName, access);
100 if (ret) goto cleanup;
101 }
102
103 if (lpszSubKey)
104 ret = RegDeleteKeyExW(hKey, lpszSubKey, access, 0);
105 else
106 while (TRUE)
107 {
108 dwSize = dwMaxLen;
109 if (RegEnumValueW(hKey, 0, lpszName, &dwSize,
110 NULL, NULL, NULL, NULL)) break;
111
112 ret = RegDeleteValueW(hKey, lpszName);
113 if (ret) goto cleanup;
114 }
115
116cleanup:
117 if (lpszName != szNameBuf) free(lpszName);
118 if (lpszSubKey) RegCloseKey(hSubKey);
119 return ret;
120}
#define ARRAY_SIZE(A)
Definition: main.h:20
#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 RegDeleteKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ REGSAM samDesired, _In_ DWORD Reserved)
Definition: reg.c:1286
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 1057 of file package.c.

1058{
1059 UINT r;
1060 DWORD size;
1061 MSIHANDLE rec;
1062
1063 rec = MsiCreateRecord( 1 );
1064 ok(rec, "MsiCreate record failed\n");
1065
1066 r = MsiRecordSetStringA( rec, 0, file );
1067 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
1068
1069 size = MAX_PATH;
1070 r = MsiFormatRecordA( hpkg, rec, buff, &size );
1071 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
1072
1073 MsiCloseHandle( rec );
1074}
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().

◆ search_absolute_directory()

static void search_absolute_directory ( LPSTR  absolute,
LPCSTR  relative 
)
static

Definition at line 5020 of file package.c.

5021{
5022 int i, size;
5023 DWORD attr, drives;
5024
5025 size = lstrlenA(relative);
5026 drives = GetLogicalDrives();
5027 lstrcpyA(absolute, "A:\\");
5028 for (i = 0; i < 26; absolute[0] = '\0', i++)
5029 {
5030 if (!(drives & (1 << i)))
5031 continue;
5032
5033 absolute[0] = 'A' + i;
5034 if (GetDriveTypeA(absolute) != DRIVE_FIXED)
5035 continue;
5036
5037 lstrcpynA(absolute + 3, relative, size + 1);
5038 attr = GetFileAttributesA(absolute);
5041 {
5042 if (absolute[3 + size - 1] != '\\')
5043 lstrcatA(absolute, "\\");
5044 break;
5045 }
5046 absolute[3] = '\0';
5047 }
5048}
#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:278

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

175{
176 WCHAR guidW[MAX_PATH];
177 WCHAR squashedW[MAX_PATH];
178 CHAR squashed[MAX_PATH];
179 CHAR comppath[MAX_PATH + 81];
180 CHAR prodpath[MAX_PATH];
182 LPCSTR prod = NULL;
183 HKEY hkey;
185
186 if (is_wow64)
188
189 MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
190 squash_guid(guidW, squashedW);
191 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
192
194 {
195 prod = "3D0DAE300FACA1300AD792060BCDAA92";
196 sprintf(comppath,
197 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
198 "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed);
199 lstrcpyA(prodpath,
200 "SOFTWARE\\Classes\\Installer\\"
201 "Products\\3D0DAE300FACA1300AD792060BCDAA92");
202 }
204 {
205 prod = "7D2F387510109040002000060BECB6AB";
206 sprintf(comppath,
207 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
208 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
209 sprintf(prodpath,
210 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
211 "Installer\\%s\\Installer\\Products\\"
212 "7D2F387510109040002000060BECB6AB", usersid);
213 }
215 {
216 prod = "7D2F387510109040002000060BECB6AB";
217 sprintf(comppath,
218 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
219 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
220 sprintf(prodpath,
221 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
222 "Installer\\Managed\\%s\\Installer\\Products\\"
223 "7D2F387510109040002000060BECB6AB", usersid);
224 }
225
226 RegCreateKeyExA(HKEY_LOCAL_MACHINE, comppath, 0, NULL, 0, access, NULL, &hkey, NULL);
227
229 lstrcatA(path, "\\");
230 if (!dir) lstrcatA(path, filename);
231
232 RegSetValueExA(hkey, prod, 0, REG_SZ, (LPBYTE)path, lstrlenA(path));
233 RegCloseKey(hkey);
234
235 RegCreateKeyExA(HKEY_LOCAL_MACHINE, prodpath, 0, NULL, 0, access, NULL, &hkey, NULL);
236 RegCloseKey(hkey);
237}
static char CURR_DIR[MAX_PATH]
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

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

6009{
6010 MSIHANDLE summary;
6011 UINT r;
6012
6013 r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
6014 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6015
6016 r = MsiSummaryInfoSetPropertyA(summary, prop, VT_I4, val, NULL, NULL);
6017 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6018
6019 r = MsiSummaryInfoPersist(summary);
6020 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6021
6022 MsiCloseHandle(summary);
6023}
@ 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:942
UINT WINAPI MsiGetSummaryInformationA(MSIHANDLE hDatabase, const char *szDatabase, UINT uiUpdateCount, MSIHANDLE *pHandle)
Definition: suminfo.c:589
UINT WINAPI MsiSummaryInfoPersist(MSIHANDLE handle)
Definition: suminfo.c:1227

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

2399{
2400 MSIHANDLE summary;
2401 UINT r;
2402
2403 r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2404 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2405
2407 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2408
2409 r = MsiSummaryInfoPersist(summary);
2410 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2411
2412 MsiCloseHandle(summary);
2413}
_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 770 of file package.c.

771{
772 UINT res;
774
775 /* build summary info */
777 ok( res == ERROR_SUCCESS , "Failed to open summaryinfo\n" );
778
780 "Installation Database");
781 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
782
784 "Installation Database");
785 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
786
788 "Wine Hackers");
789 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
790
792 ";1033");
793 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
794
796 "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}");
797 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
798
800 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
801
803 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
804
806 ok( res == ERROR_SUCCESS , "Failed to make summary info persist\n" );
807
809 ok( res == ERROR_SUCCESS , "Failed to close suminfo\n" );
810
811 return res;
812}
static const CHAR suminfo[]
Definition: db.c:2166
@ 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 2381 of file package.c.

2382{
2383 MSIHANDLE summary;
2384 UINT r;
2385
2386 r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2387 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2388
2390 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2391
2392 r = MsiSummaryInfoPersist(summary);
2393 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2394
2395 MsiCloseHandle(summary);
2396}

Referenced by test_msipackage(), and test_states().

◆ squash_guid()

static BOOL squash_guid ( LPCWSTR  in,
LPWSTR  out 
)
static

Definition at line 122 of file package.c.

123{
124 DWORD i,n=1;
125 GUID guid;
126
127 if (FAILED(CLSIDFromString((LPCOLESTR)in, &guid)))
128 return FALSE;
129
130 for(i=0; i<8; i++)
131 out[7-i] = in[n++];
132 n++;
133 for(i=0; i<4; i++)
134 out[11-i] = in[n++];
135 n++;
136 for(i=0; i<4; i++)
137 out[15-i] = in[n++];
138 n++;
139 for(i=0; i<2; i++)
140 {
141 out[17+i*2] = in[n++];
142 out[16+i*2] = in[n++];
143 }
144 n++;
145 for( ; i<8; i++)
146 {
147 out[17+i*2] = in[n++];
148 out[16+i*2] = in[n++];
149 }
150 out[32]=0;
151 return TRUE;
152}
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
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383

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

◆ START_TEST()

START_TEST ( package  )

Definition at line 9493 of file package.c.

9494{
9495 char temp_path[MAX_PATH], prev_path[MAX_PATH];
9496 DWORD len;
9497
9499
9501
9502 GetCurrentDirectoryA(MAX_PATH, prev_path);
9505
9508
9509 if (len && (CURR_DIR[len - 1] == '\\'))
9510 CURR_DIR[len - 1] = 0;
9511
9513 test_doaction();
9516 test_props();
9522 test_states();
9537 test_access();
9543 test_costs();
9549
9550 SetCurrentDirectoryA(prev_path);
9551}
#define IsWow64Process
Definition: compat.h:760
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 BOOL is_process_elevated(void)
Definition: dplayx.c:6742
void restart_as_admin_elevated(void)
Definition: action.c:6478
static void test_removefiles(void)
Definition: package.c:3711
static void test_property_table(void)
Definition: package.c:2222
static void test_formatrecord_tables(void)
Definition: package.c:2600
static void test_access(void)
Definition: package.c:7610
static void test_doaction(void)
Definition: package.c:962
static void test_controlevent(void)
Definition: package.c:9174
static void test_MsiApplyPatch(void)
Definition: package.c:8297
static void test_msipackage(void)
Definition: package.c:2415
static void test_installprops(void)
Definition: package.c:5428
static void test_appsearch_reglocator(void)
Definition: package.c:4226
static void test_props(void)
Definition: package.c:2006
static void test_complocator(void)
Definition: package.c:5767
static void test_MsiDatabaseCommit(void)
Definition: package.c:8515
static void test_appsearch(void)
Definition: package.c:3860
static void test_MsiGetProductProperty(void)
Definition: package.c:7809
static void test_appsearch_drlocator(void)
Definition: package.c:5050
static void test_MsiGetSourcePath(void)
Definition: package.c:6025
static void test_settargetpath(void)
Definition: package.c:1076
static void test_gettargetpath_bad(void)
Definition: package.c:992
static void test_sourcedir(void)
Definition: package.c:7140
static void test_MsiApplyMultiplePatches(void)
Definition: package.c:8253
static void test_MsiSetProperty(void)
Definition: package.c:8138
static void test_ccpsearch(void)
Definition: package.c:5721
static void test_createpackage(void)
Definition: package.c:943
static void test_launchconditions(void)
Definition: package.c:5672
static void test_emptypackage(void)
Definition: package.c:7644
static void test_featureparents(void)
Definition: package.c:5258
static void test_shortlongsource(void)
Definition: package.c:6806
static void test_condition(void)
Definition: package.c:1244
static void test_appsearch_inilocator(void)
Definition: package.c:4806
static void test_costs(void)
Definition: package.c:8308
static void test_appsearch_complocator(void)
Definition: package.c:3977
static void test_top_level_action(void)
Definition: package.c:9402
static void test_externalui_message(void)
Definition: package.c:8960
static void test_externalui(void)
Definition: package.c:8584
static void test_states(void)
Definition: package.c:2913
static void test_formatrecord2(void)
Definition: package.c:2510
char temp_path[MAX_PATH]
Definition: mspatcha.c:123

◆ test_access()

static void test_access ( void  )
static

Definition at line 7610 of file package.c.

7611{
7612 MSIHANDLE hdb;
7613 UINT r;
7614
7616 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7617
7619
7620 r = MsiDatabaseCommit(hdb);
7621 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7622
7624 MsiCloseHandle(hdb);
7625
7628
7630 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7631
7633
7634 r = MsiDatabaseCommit(hdb);
7635 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7636
7638 MsiCloseHandle(hdb);
7639
7642}
static const struct access_res create[16]
Definition: package.c:7505
static const struct access_res create_close[16]
Definition: package.c:7545
static const struct access_res create_commit[16]
Definition: package.c:7525
#define test_file_access(file, ares)
Definition: package.c:7608
#define MSIDBOPEN_CREATEDIRECT
Definition: msiquery.h:70

Referenced by START_TEST().

◆ test_appsearch()

static void test_appsearch ( void  )
static

Definition at line 3860 of file package.c.

3861{
3862 MSIHANDLE hpkg;
3863 UINT r;
3864 MSIHANDLE hdb;
3865 CHAR prop[MAX_PATH];
3866 DWORD size;
3867 HKEY hkey;
3868 const char reg_expand_value[] = "%systemroot%\\system32\\notepad.exe";
3869
3870 hdb = create_package_db();
3871 ok ( hdb, "failed to create package database\n" );
3872
3874 add_appsearch_entry( hdb, "'WEBBROWSERPROG', 'NewSignature1'" );
3875 add_appsearch_entry( hdb, "'NOTEPAD', 'NewSignature2'" );
3876 add_appsearch_entry( hdb, "'REGEXPANDVAL', 'NewSignature3'" );
3877 add_appsearch_entry( hdb, "'32KEYVAL', 'NewSignature4'" );
3878 add_appsearch_entry( hdb, "'64KEYVAL', 'NewSignature5'" );
3879
3881 add_reglocator_entry( hdb, "NewSignature1", 0, "htmlfile\\shell\\open\\command", "", 1 );
3882
3883 r = RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Winetest_msi", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hkey, NULL);
3884 ok( r == ERROR_SUCCESS, "Could not create key: %d.\n", r );
3885 r = RegSetValueExA(hkey, NULL, 0, REG_EXPAND_SZ, (const BYTE*)reg_expand_value, strlen(reg_expand_value) + 1);
3886 ok( r == ERROR_SUCCESS, "Could not set key value: %d.\n", r);
3887 RegCloseKey(hkey);
3888 add_reglocator_entry( hdb, "NewSignature3", 1, "Software\\Winetest_msi", "", msidbLocatorTypeFileName );
3889
3890 r = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Winetest_msi", 0, NULL, 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY,
3891 NULL, &hkey, NULL);
3892 if (r == ERROR_ACCESS_DENIED)
3893 {
3894 skip("insufficient rights\n");
3895 RegDeleteKeyA(HKEY_CURRENT_USER, "Software\\Winetest_msi");
3896 MsiCloseHandle(hdb);
3898 return;
3899 }
3900 ok( r == ERROR_SUCCESS, "Could not create key: %d.\n", r );
3901
3902 r = RegSetValueExA(hkey, NULL, 0, REG_SZ, (const BYTE *)"c:\\windows\\system32\\notepad.exe",
3903 sizeof("c:\\windows\\system32\\notepad.exe"));
3904 ok( r == ERROR_SUCCESS, "Could not set key value: %d.\n", r);
3905 RegCloseKey(hkey);
3906 add_reglocator_entry( hdb, "NewSignature4", 2, "Software\\Winetest_msi", "", msidbLocatorTypeFileName );
3907
3908 r = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Winetest_msi", 0, NULL, 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY,
3909 NULL, &hkey, NULL);
3910 ok( r == ERROR_SUCCESS, "Could not create key: %d.\n", r );
3911 r = RegSetValueExA(hkey, NULL, 0, REG_SZ, (const BYTE *)"c:\\windows\\system32\\notepad.exe",
3912 sizeof("c:\\windows\\system32\\notepad.exe"));
3913 ok( r == ERROR_SUCCESS, "Could not set key value: %d.\n", r);
3914 RegCloseKey(hkey);
3915 add_reglocator_entry( hdb, "NewSignature5", 2, "Software\\Winetest_msi", "",
3917
3919 add_drlocator_entry( hdb, "'NewSignature2', 0, 'c:\\windows\\system32', 0" );
3920
3922 add_signature_entry( hdb, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
3923 add_signature_entry( hdb, "'NewSignature2', 'NOTEPAD.EXE|notepad.exe', '', '', '', '', '', '', ''" );
3924 add_signature_entry( hdb, "'NewSignature3', 'NOTEPAD.EXE|notepad.exe', '', '', '', '', '', '', ''" );
3925 add_signature_entry( hdb, "'NewSignature4', 'NOTEPAD.EXE|notepad.exe', '', '', '', '', '', '', ''" );
3926 add_signature_entry( hdb, "'NewSignature5', 'NOTEPAD.EXE|notepad.exe', '', '', '', '', '', '', ''" );
3927
3928 r = package_from_db( hdb, &hpkg );
3930 {
3931 skip("Not enough rights to perform tests\n");
3933 return;
3934 }
3935 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
3936 MsiCloseHandle( hdb );
3937 if (r != ERROR_SUCCESS)
3938 goto done;
3939
3941
3942 r = MsiDoActionA( hpkg, "AppSearch" );
3943 ok( r == ERROR_SUCCESS, "AppSearch failed: %d\n", r);
3944
3945 size = sizeof(prop);
3946 r = MsiGetPropertyA( hpkg, "WEBBROWSERPROG", prop, &size );
3947 ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
3948 ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
3949
3950 size = sizeof(prop);
3951 r = MsiGetPropertyA( hpkg, "NOTEPAD", prop, &size );
3952 ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
3953
3954 size = sizeof(prop);
3955 r = MsiGetPropertyA( hpkg, "REGEXPANDVAL", prop, &size );
3956 ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
3957 ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
3958
3959 size = sizeof(prop);
3960 r = MsiGetPropertyA( hpkg, "32KEYVAL", prop, &size );
3961 ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
3962 ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
3963
3964 size = sizeof(prop);
3965 r = MsiGetPropertyA( hpkg, "64KEYVAL", prop, &size );
3966 ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
3967 ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
3968
3969done:
3970 MsiCloseHandle( hpkg );
3972 RegDeleteKeyA(HKEY_CURRENT_USER, "Software\\Winetest_msi");
3973 RegDeleteKeyExA(HKEY_LOCAL_MACHINE, "Software\\Winetest_msi", KEY_WOW64_32KEY, 0);
3974 RegDeleteKeyExA(HKEY_LOCAL_MACHINE, "Software\\Winetest_msi", KEY_WOW64_64KEY, 0);
3975}
#define skip(...)
Definition: atltest.h:64
LONG WINAPI RegDeleteKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ REGSAM samDesired, _In_ DWORD Reserved)
Definition: reg.c:1254
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1224
#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:2281
#define add_signature_entry(hdb, values)
Definition: package.c:680
static UINT package_from_db(MSIHANDLE hdb, MSIHANDLE *handle)
Definition: package.c:845
static UINT create_appsearch_table(MSIHANDLE hdb)
Definition: package.c:389
static UINT create_reglocator_table(MSIHANDLE hdb)
Definition: package.c:400
static UINT create_drlocator_table(MSIHANDLE hdb)
Definition: package.c:503
static UINT add_reglocator_entry(MSIHANDLE hdb, const char *sig, UINT root, const char *path, const char *name, UINT type)
Definition: package.c:752
static MSIHANDLE create_package_db(void)
Definition: package.c:815
#define add_drlocator_entry(hdb, values)
Definition: package.c:715
static UINT create_signature_table(MSIHANDLE hdb)
Definition: package.c:414
#define add_appsearch_entry(hdb, values)
Definition: package.c:676
@ 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 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 3977 of file package.c.

3978{
3979 MSIHANDLE hpkg, hdb;
3980 char path[MAX_PATH + 15], expected[MAX_PATH], prop[MAX_PATH];
3981 LPSTR usersid;
3982 DWORD size;
3983 UINT r;
3984
3985 if (!(usersid = get_user_sid()))
3986 return;
3987
3988 if (!is_process_elevated())
3989 {
3990 skip("process is limited\n");
3991 return;
3992 }
3993
3994 create_test_file("FileName1");
3995 create_test_file("FileName4");
3997 "{A8AE6692-96BA-4198-8399-145D7D1D0D0E}", NULL, FALSE);
3998
3999 create_test_file("FileName2");
4001 "{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}", usersid, FALSE);
4002
4003 create_test_file("FileName3");
4005 "{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}", usersid, FALSE);
4006
4007 create_test_file("FileName5");
4009 "{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}", NULL, TRUE);
4010
4011 create_test_file("FileName6");
4013 "{C0ECD96F-7898-4410-9667-194BD8C1B648}", NULL, TRUE);
4014
4015 create_test_file("FileName7");
4017 "{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}", NULL, FALSE);
4018
4019 /* dir is FALSE, but we're pretending it's a directory */
4021 "{91B7359B-07F2-4221-AA8D-DE102BB87A5F}", NULL, FALSE);
4022
4023 create_file_with_version("FileName8.dll", MAKELONG(2, 1), MAKELONG(4, 3));
4025 "{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}", NULL, FALSE);
4026
4027 create_file_with_version("FileName9.dll", MAKELONG(1, 2), MAKELONG(3, 4));
4029 "{A204DF48-7346-4635-BA2E-66247DBAC9DF}", NULL, FALSE);
4030
4031 create_file_with_version("FileName10.dll", MAKELONG(2, 1), MAKELONG(4, 3));
4033 "{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}", NULL, FALSE);
4034
4035 hdb = create_package_db();
4036 ok(hdb, "Expected a valid database handle\n");
4037
4039 add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
4040 add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
4041 add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
4042 add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
4043 add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
4044 add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
4045 add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
4046 add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
4047 add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
4048 add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
4049 add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
4050 add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
4051
4053
4054 /* published component, machine, file, signature, misdbLocatorTypeFile */
4055 add_complocator_entry(hdb, "'NewSignature1', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 1");
4056
4057 /* published component, user-unmanaged, file, signature, misdbLocatorTypeFile */
4058 add_complocator_entry(hdb, "'NewSignature2', '{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}', 1");
4059
4060 /* published component, user-managed, file, signature, misdbLocatorTypeFile */
4061 add_complocator_entry(hdb, "'NewSignature3', '{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}', 1");
4062
4063 /* published component, machine, file, signature, misdbLocatorTypeDirectory */
4064 add_complocator_entry(hdb, "'NewSignature4', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 0");
4065
4066 /* published component, machine, dir, signature, misdbLocatorTypeDirectory */
4067 add_complocator_entry(hdb, "'NewSignature5', '{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}', 0");
4068
4069 /* published component, machine, dir, no signature, misdbLocatorTypeDirectory */
4070 add_complocator_entry(hdb, "'NewSignature6', '{C0ECD96F-7898-4410-9667-194BD8C1B648}', 0");
4071
4072 /* published component, machine, file, no signature, misdbLocatorTypeFile */
4073 add_complocator_entry(hdb, "'NewSignature7', '{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}', 1");
4074
4075 /* unpublished component, no signature, misdbLocatorTypeDir */
4076 add_complocator_entry(hdb, "'NewSignature8', '{FB671D5B-5083-4048-90E0-481C48D8F3A5}', 0");
4077
4078 /* published component, no signature, dir does not exist misdbLocatorTypeDir */
4079 add_complocator_entry(hdb, "'NewSignature9', '{91B7359B-07F2-4221-AA8D-DE102BB87A5F}', 0");
4080
4081 /* published component, signature w/ ver, misdbLocatorTypeFile */
4082 add_complocator_entry(hdb, "'NewSignature10', '{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}', 1");
4083
4084 /* published component, signature w/ ver, ver > max, misdbLocatorTypeFile */
4085 add_complocator_entry(hdb, "'NewSignature11', '{A204DF48-7346-4635-BA2E-66247DBAC9DF}', 1");
4086
4087 /* published component, signature w/ ver, sig->name ignored, misdbLocatorTypeFile */
4088 add_complocator_entry(hdb, "'NewSignature12', '{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}', 1");
4089
4091 add_signature_entry(hdb, "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''");
4092 add_signature_entry(hdb, "'NewSignature2', 'FileName2', '', '', '', '', '', '', ''");
4093 add_signature_entry(hdb, "'NewSignature3', 'FileName3', '', '', '', '', '', '', ''");
4094 add_signature_entry(hdb, "'NewSignature4', 'FileName4', '', '', '', '', '', '', ''");
4095 add_signature_entry(hdb, "'NewSignature5', 'FileName5', '', '', '', '', '', '', ''");
4096 add_signature_entry(hdb, "'NewSignature10', 'FileName8.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
4097 add_signature_entry(hdb, "'NewSignature11', 'FileName9.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
4098 add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
4099
4100 r = package_from_db(hdb, &hpkg);
4102 {
4103 skip("Not enough rights to perform tests\n");
4104 goto error;
4105 }
4106 ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
4107
4108 r = MsiSetPropertyA(hpkg, "SIGPROP8", "october");
4109 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4110
4112
4113 r = MsiDoActionA(hpkg, "AppSearch");
4114 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4115
4117 if (is_root(CURR_DIR)) expected[2] = 0;
4118
4119 size = MAX_PATH;
4120 sprintf(path, "%s\\FileName1", expected);
4121 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
4122 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4123 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
4124
4125 size = MAX_PATH;
4126 sprintf(path, "%s\\FileName2", expected);
4127 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
4128 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4129 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
4130
4131 size = MAX_PATH;
4132 sprintf(path, "%s\\FileName3", expected);
4133 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
4134 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4135 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
4136
4137 size = MAX_PATH;
4138 sprintf(path, "%s\\FileName4", expected);
4139 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
4140 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4141 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
4142
4143 size = MAX_PATH;
4144 sprintf(path, "%s\\FileName5", expected);
4145 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
4146 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4147 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
4148
4149 size = MAX_PATH;
4150 sprintf(path, "%s\\", expected);
4151 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
4152 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4153 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
4154
4155 size = MAX_PATH;
4156 sprintf(path, "%s\\", expected);
4157 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
4158 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4159 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
4160
4161 size = MAX_PATH;
4162 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
4163 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4164 ok(!lstrcmpA(prop, "october"), "Expected \"october\", got \"%s\"\n", prop);
4165
4166 size = MAX_PATH;
4167 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
4168 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4169 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
4170
4171 size = MAX_PATH;
4172 sprintf(path, "%s\\FileName8.dll", expected);
4173 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
4174 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4175 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
4176
4177 size = MAX_PATH;
4178 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
4179 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4180 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
4181
4182 size = MAX_PATH;
4183 sprintf(path, "%s\\FileName10.dll", expected);
4184 r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
4185 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4186 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
4187
4188 delete_component_path("{A8AE6692-96BA-4198-8399-145D7D1D0D0E}",
4190 delete_component_path("{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}",
4192 delete_component_path("{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}",
4194 delete_component_path("{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}",
4196 delete_component_path("{C0ECD96F-7898-4410-9667-194BD8C1B648}",
4198 delete_component_path("{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}",
4200 delete_component_path("{91B7359B-07F2-4221-AA8D-DE102BB87A5F}",
4202 delete_component_path("{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}",
4204 delete_component_path("{A204DF48-7346-4635-BA2E-66247DBAC9DF}",
4206 delete_component_path("{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}",
4208
4209 MsiCloseHandle(hpkg);
4210
4211error:
4212 DeleteFileA("FileName1");
4213 DeleteFileA("FileName2");
4214 DeleteFileA("FileName3");
4215 DeleteFileA("FileName4");
4216 DeleteFileA("FileName5");
4217 DeleteFileA("FileName6");
4218 DeleteFileA("FileName7");
4219 DeleteFileA("FileName8.dll");
4220 DeleteFileA("FileName9.dll");
4221 DeleteFileA("FileName10.dll");
4223 LocalFree(usersid);
4224}
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:516
static void delete_component_path(LPCSTR guid, MSIINSTALLCONTEXT context, LPSTR usersid)
Definition: package.c:239
static char * get_user_sid(void)
Definition: package.c:41
#define add_complocator_entry(hdb, values)
Definition: package.c:719
static BOOL create_file_with_version(const CHAR *name, LONG ms, LONG ls)
Definition: package.c:890
static void set_component_path(LPCSTR filename, MSIINSTALLCONTEXT context, LPCSTR guid, LPSTR usersid, BOOL dir)
Definition: package.c:173
static BOOL is_root(const char *path)
Definition: package.c:938
static void create_test_file(const CHAR *name)
Definition: package.c:870
#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 5050 of file package.c.

5051{
5052 MSIHANDLE hpkg, hdb;
5053 char path[MAX_PATH + 27], expected[MAX_PATH], prop[MAX_PATH];
5054 BOOL version;
5055 DWORD size;
5056 UINT r;
5057
5058 version = TRUE;
5059 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
5060 version = FALSE;
5061
5062 DeleteFileA("test.dll");
5063
5064 create_test_file("FileName1");
5065 CreateDirectoryA("one", NULL);
5066 CreateDirectoryA("one\\two", NULL);
5067 CreateDirectoryA("one\\two\\three", NULL);
5068 create_test_file("one\\two\\three\\FileName2");
5069 CreateDirectoryA("another", NULL);
5070 create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
5071 create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
5072 create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
5073
5074 hdb = create_package_db();
5075 ok(hdb, "Expected a valid database handle\n");
5076
5078 add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
5079 add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
5080 add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
5081 add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
5082 add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
5083 add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
5084 add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
5085 add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
5086 add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
5087 add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
5088 add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
5089 add_appsearch_entry(hdb, "'SIGPROP13', 'NewSignature13'");
5090
5092
5094 if (is_root(CURR_DIR)) expected[2] = 0;
5095
5096 /* no parent, full path, depth 0, signature */
5097 sprintf(path, "'NewSignature1', '', '%s', 0", expected);
5099
5100 /* no parent, full path, depth 0, no signature */
5101 sprintf(path, "'NewSignature2', '', '%s', 0", expected);
5103
5104 /* no parent, relative path, depth 0, no signature */
5105 sprintf(path, "'NewSignature3', '', '%s', 0", expected + 3);
5107
5108 /* no parent, full path, depth 2, signature */
5109 sprintf(path, "'NewSignature4', '', '%s', 2", expected);
5111
5112 /* no parent, full path, depth 3, signature */
5113 sprintf(path, "'NewSignature5', '', '%s', 3", expected);
5115
5116 /* no parent, full path, depth 1, signature is dir */
5117 sprintf(path, "'NewSignature6', '', '%s', 1", expected);
5119
5120 /* parent is in DrLocator, relative path, depth 0, signature */
5121 sprintf(path, "'NewSignature7', 'NewSignature1', 'one\\two\\three', 1");
5123
5124 /* no parent, full path, depth 0, signature w/ version */
5125 sprintf(path, "'NewSignature8', '', '%s', 0", expected);
5127
5128 /* no parent, full path, depth 0, signature w/ version, ver > max */
5129 sprintf(path, "'NewSignature9', '', '%s', 0", expected);
5131
5132 /* no parent, full path, depth 0, signature w/ version, sig->name not ignored */
5133 sprintf(path, "'NewSignature10', '', '%s', 0", expected);
5135
5136 /* no parent, relative empty path, depth 0, no signature */
5137 sprintf(path, "'NewSignature11', '', '', 0");
5139
5141
5142 /* parent */
5143 add_reglocator_entry(hdb, "NewSignature12", 2, "htmlfile\\shell\\open\\nonexistent", "", 1);
5144
5145 /* parent is in RegLocator, no path, depth 0, no signature */
5146 sprintf(path, "'NewSignature13', 'NewSignature12', '', 0");
5148
5150 add_signature_entry(hdb, "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''");
5151 add_signature_entry(hdb, "'NewSignature4', 'FileName2', '', '', '', '', '', '', ''");
5152 add_signature_entry(hdb, "'NewSignature5', 'FileName2', '', '', '', '', '', '', ''");
5153 add_signature_entry(hdb, "'NewSignature6', 'another', '', '', '', '', '', '', ''");
5154 add_signature_entry(hdb, "'NewSignature7', 'FileName2', '', '', '', '', '', '', ''");
5155 add_signature_entry(hdb, "'NewSignature8', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
5156 add_signature_entry(hdb, "'NewSignature9', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
5157 add_signature_entry(hdb, "'NewSignature10', 'necessary', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
5158
5159 r = package_from_db(hdb, &hpkg);
5161 {
5162 skip("Not enough rights to perform tests\n");
5163 goto error;
5164 }
5165 ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
5166
5168
5169 r = MsiDoActionA(hpkg, "AppSearch");
5170 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5171
5172 size = MAX_PATH;
5173 sprintf(path, "%s\\FileName1", expected);
5174 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
5175 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5176 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
5177
5178 size = MAX_PATH;
5179 sprintf(path, "%s\\", expected);
5180 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
5181 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5182 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
5183
5184 size = MAX_PATH;
5186 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
5187 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5188 ok(!lstrcmpiA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
5189
5190 size = MAX_PATH;
5191 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
5192 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5193 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
5194
5195 size = MAX_PATH;
5196 sprintf(path, "%s\\one\\two\\three\\FileName2", expected);
5197 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
5198 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5199 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
5200
5201 size = MAX_PATH;
5202 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
5203 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5204 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
5205
5206 size = MAX_PATH;
5207 sprintf(path, "%s\\one\\two\\three\\FileName2", expected);
5208 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
5209 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5210 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
5211
5212 if (version)
5213 {
5214 size = MAX_PATH;
5215 sprintf(path, "%s\\FileName3.dll", expected);
5216 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
5217 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5218 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
5219
5220 size = MAX_PATH;
5221 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
5222 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5223 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
5224
5225 size = MAX_PATH;
5226 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
5227 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5228 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
5229 }
5230
5231 size = MAX_PATH;
5233 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
5234 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5235 ok(!lstrcmpiA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
5236
5237 size = MAX_PATH;
5238 strcpy(path, "c:\\");
5239 r = MsiGetPropertyA(hpkg, "SIGPROP13", prop, &size);
5240 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5241 ok(!prop[0], "Expected \"\", got \"%s\"\n", prop);
5242
5243 MsiCloseHandle(hpkg);
5244
5245error:
5246 DeleteFileA("FileName1");
5247 DeleteFileA("FileName3.dll");
5248 DeleteFileA("FileName4.dll");
5249 DeleteFileA("FileName5.dll");
5250 DeleteFileA("one\\two\\three\\FileName2");
5251 RemoveDirectoryA("one\\two\\three");
5252 RemoveDirectoryA("one\\two");
5253 RemoveDirectoryA("one");
5254 RemoveDirectoryA("another");
5256}
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:4224
static void search_absolute_directory(LPSTR absolute, LPCSTR relative)
Definition: package.c:5020

Referenced by START_TEST().

◆ test_appsearch_inilocator()

static void test_appsearch_inilocator ( void  )
static

Definition at line 4806 of file package.c.

4807{
4808 MSIHANDLE hpkg, hdb;
4809 char path[MAX_PATH + 14], expected[MAX_PATH], prop[MAX_PATH];
4810 BOOL version;
4811 LPSTR ptr;
4812 DWORD size;
4813 UINT r;
4814
4815 version = TRUE;
4816 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
4817 version = FALSE;
4818
4819 DeleteFileA("test.dll");
4820
4821 WritePrivateProfileStringA("Section", "Key", "keydata,field2", "IniFile.ini");
4822
4824 if (is_root(CURR_DIR)) expected[2] = 0;
4825
4826 create_test_file("FileName1");
4827 sprintf(path, "%s\\FileName1", expected);
4828 WritePrivateProfileStringA("Section", "Key2", path, "IniFile.ini");
4829
4830 WritePrivateProfileStringA("Section", "Key3", expected, "IniFile.ini");
4831
4832 sprintf(path, "%s\\IDontExist", expected);
4833 WritePrivateProfileStringA("Section", "Key4", path, "IniFile.ini");
4834
4835 create_file_with_version("FileName2.dll", MAKELONG(2, 1), MAKELONG(4, 3));
4836 sprintf(path, "%s\\FileName2.dll", expected);
4837 WritePrivateProfileStringA("Section", "Key5", path, "IniFile.ini");
4838
4839 create_file_with_version("FileName3.dll", MAKELONG(1, 2), MAKELONG(3, 4));
4840 sprintf(path, "%s\\FileName3.dll", expected);
4841 WritePrivateProfileStringA("Section", "Key6", path, "IniFile.ini");
4842
4843 create_file_with_version("FileName4.dll", MAKELONG(2, 1), MAKELONG(4, 3));
4844 sprintf(path, "%s\\FileName4.dll", expected);
4845 WritePrivateProfileStringA("Section", "Key7", path, "IniFile.ini");
4846
4847 hdb = create_package_db();
4848 ok(hdb, "Expected a valid database handle\n");
4849
4851 add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
4852 add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
4853 add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
4854 add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
4855 add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
4856 add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
4857 add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
4858 add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
4859 add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
4860 add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
4861 add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
4862 add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
4863
4865
4866 /* msidbLocatorTypeRawValue, field 1 */
4867 add_inilocator_entry(hdb, "'NewSignature1', 'IniFile.ini', 'Section', 'Key', 1, 2");
4868
4869 /* msidbLocatorTypeRawValue, field 2 */
4870 add_inilocator_entry(hdb, "'NewSignature2', 'IniFile.ini', 'Section', 'Key', 2, 2");
4871
4872 /* msidbLocatorTypeRawValue, entire field */
4873 add_inilocator_entry(hdb, "'NewSignature3', 'IniFile.ini', 'Section', 'Key', 0, 2");
4874
4875 /* msidbLocatorTypeFile */
4876 add_inilocator_entry(hdb, "'NewSignature4', 'IniFile.ini', 'Section', 'Key2', 1, 1");
4877
4878 /* msidbLocatorTypeDirectory, file */
4879 add_inilocator_entry(hdb, "'NewSignature5', 'IniFile.ini', 'Section', 'Key2', 1, 0");
4880
4881 /* msidbLocatorTypeDirectory, directory */
4882 add_inilocator_entry(hdb, "'NewSignature6', 'IniFile.ini', 'Section', 'Key3', 1, 0");
4883
4884 /* msidbLocatorTypeFile, file, no signature */
4885 add_inilocator_entry(hdb, "'NewSignature7', 'IniFile.ini', 'Section', 'Key2', 1, 1");
4886
4887 /* msidbLocatorTypeFile, dir, no signature */
4888 add_inilocator_entry(hdb, "'NewSignature8', 'IniFile.ini', 'Section', 'Key3', 1, 1");
4889
4890 /* msidbLocatorTypeFile, file does not exist */
4891 add_inilocator_entry(hdb, "'NewSignature9', 'IniFile.ini', 'Section', 'Key4', 1, 1");
4892
4893 /* msidbLocatorTypeFile, signature with version */
4894 add_inilocator_entry(hdb, "'NewSignature10', 'IniFile.ini', 'Section', 'Key5', 1, 1");
4895
4896 /* msidbLocatorTypeFile, signature with version, ver > max */
4897 add_inilocator_entry(hdb, "'NewSignature11', 'IniFile.ini', 'Section', 'Key6', 1, 1");
4898
4899 /* msidbLocatorTypeFile, signature with version, sig->name ignored */
4900 add_inilocator_entry(hdb, "'NewSignature12', 'IniFile.ini', 'Section', 'Key7', 1, 1");
4901
4903 add_signature_entry(hdb, "'NewSignature4', 'FileName1', '', '', '', '', '', '', ''");
4904 add_signature_entry(hdb, "'NewSignature9', 'IDontExist', '', '', '', '', '', '', ''");
4905 add_signature_entry(hdb, "'NewSignature10', 'FileName2.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
4906 add_signature_entry(hdb, "'NewSignature11', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
4907 add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
4908
4909 r = package_from_db(hdb, &hpkg);
4911 {
4912 skip("Not enough rights to perform tests\n");
4913 goto error;
4914 }
4915 ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
4916
4917 MsiCloseHandle( hdb );
4919
4920 r = MsiDoActionA(hpkg, "AppSearch");
4921 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4922
4923 size = MAX_PATH;
4924 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
4925 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4926 if (!prop[0])
4927 {
4928 win_skip("broken result\n");
4929 MsiCloseHandle(hpkg);
4930 goto error;
4931 }
4932 ok(!lstrcmpA(prop, "keydata"), "Expected \"keydata\", got \"%s\"\n", prop);
4933
4934 size = MAX_PATH;
4935 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
4936 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4937 ok(!lstrcmpA(prop, "field2"), "Expected \"field2\", got \"%s\"\n", prop);
4938
4939 size = MAX_PATH;
4940 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
4941 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4942 ok(!lstrcmpA(prop, "keydata,field2"),
4943 "Expected \"keydata,field2\", got \"%s\"\n", prop);
4944
4945 size = MAX_PATH;
4946 sprintf(path, "%s\\FileName1", expected);
4947 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
4948 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4949 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
4950
4951 size = MAX_PATH;
4952 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
4953 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4954 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
4955
4956 size = MAX_PATH;
4957 sprintf(path, "%s\\", expected);
4958 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
4959 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4960 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
4961
4962 size = MAX_PATH;
4963 sprintf(path, "%s\\", expected);
4964 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
4965 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4966 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
4967
4968 if (!is_root(CURR_DIR))
4969 {
4970 size = MAX_PATH;
4972 ptr = strrchr(path, '\\');
4973 *(ptr + 1) = 0;
4974 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
4975 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4976 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
4977 }
4978 size = MAX_PATH;
4979 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
4980 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4981 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
4982
4983 if (version)
4984 {
4985 size = MAX_PATH;
4986 sprintf(path, "%s\\FileName2.dll", expected);
4987 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
4988 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4989 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
4990
4991 size = MAX_PATH;
4992 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
4993 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4994 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
4995
4996 size = MAX_PATH;
4997 sprintf(path, "%s\\FileName4.dll", expected);
4998 r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
4999 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5000 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
5001 }
5002
5003 MsiCloseHandle(hpkg);
5004
5005error:
5006 delete_win_ini("IniFile.ini");
5007 DeleteFileA("FileName1");
5008 DeleteFileA("FileName2.dll");
5009 DeleteFileA("FileName3.dll");
5010 DeleteFileA("FileName4.dll");
5012}
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:528
#define add_inilocator_entry(hdb, values)
Definition: package.c:723
static void delete_win_ini(LPCSTR file)
Definition: package.c:4795
_CRT_RESTORE_GCC_WARNINGS _CRT_DISABLE_GCC_WARNINGS _Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
#define win_skip
Definition: test.h:163

Referenced by START_TEST().

◆ test_appsearch_reglocator()

static void test_appsearch_reglocator ( void  )
static

Definition at line 4226 of file package.c.

4227{
4228 MSIHANDLE hpkg, hdb;
4229 char path[MAX_PATH + 20], expected[MAX_PATH], prop[MAX_PATH];
4230 DWORD binary[2], size, val;
4231 BOOL space, version, is_64bit = sizeof(void *) > sizeof(int);
4232 HKEY hklm, classes, hkcu, users;
4233 LPSTR pathdata, pathvar, ptr;
4234 LONG res;
4235 UINT r, type = 0;
4236 SYSTEM_INFO si;
4237
4238 version = TRUE;
4239 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
4240 version = FALSE;
4241
4242 DeleteFileA("test.dll");
4243
4244 res = RegCreateKeyA(HKEY_CLASSES_ROOT, "Software\\Wine", &classes);
4245 if (res == ERROR_ACCESS_DENIED)
4246 {
4247 skip("Not enough rights to perform tests\n");
4248 return;
4249 }
4250 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4251
4252 res = RegSetValueExA(classes, "Value1", 0, REG_SZ,
4253 (const BYTE *)"regszdata", 10);
4254 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4255
4256 res = RegCreateKeyA(HKEY_CURRENT_USER, "Software\\Wine", &hkcu);
4257 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4258
4259 res = RegSetValueExA(hkcu, "Value1", 0, REG_SZ,
4260 (const BYTE *)"regszdata", 10);
4261 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4262
4263 users = 0;
4264 res = RegCreateKeyA(HKEY_USERS, "S-1-5-18\\Software\\Wine", &users);
4265 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4266
4267 if (res == ERROR_SUCCESS)
4268 {
4269 res = RegSetValueExA(users, "Value1", 0, REG_SZ,
4270 (const BYTE *)"regszdata", 10);
4271 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4272 }
4273
4274 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine", &hklm);
4275 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4276
4277 res = RegSetValueA(hklm, NULL, REG_SZ, "defvalue", 8);
4278 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4279
4280 res = RegSetValueExA(hklm, "Value1", 0, REG_SZ,
4281 (const BYTE *)"regszdata", 10);
4282 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4283
4284 val = 42;
4285 res = RegSetValueExA(hklm, "Value2", 0, REG_DWORD,
4286 (const BYTE *)&val, sizeof(DWORD));
4287 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4288
4289 val = -42;
4290 res = RegSetValueExA(hklm, "Value3", 0, REG_DWORD,
4291 (const BYTE *)&val, sizeof(DWORD));
4292 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4293
4294 res = RegSetValueExA(hklm, "Value4", 0, REG_EXPAND_SZ,
4295 (const BYTE *)"%PATH%", 7);
4296 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4297
4298 res = RegSetValueExA(hklm, "Value5", 0, REG_EXPAND_SZ,
4299 (const BYTE *)"my%NOVAR%", 10);
4300 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4301
4302 res = RegSetValueExA(hklm, "Value6", 0, REG_MULTI_SZ,
4303 (const BYTE *)"one\0two\0", 9);
4304 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4305
4306 binary[0] = 0x1234abcd;
4307 binary[1] = 0x567890ef;
4308 res = RegSetValueExA(hklm, "Value7", 0, REG_BINARY,
4309 (const BYTE *)binary, sizeof(binary));
4310 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4311
4312 res = RegSetValueExA(hklm, "Value8", 0, REG_SZ,
4313 (const BYTE *)"#regszdata", 11);
4314 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4315
4317 if (is_root(CURR_DIR)) expected[2] = 0;
4318
4319 create_test_file("FileName1");
4320 sprintf(path, "%s\\FileName1", expected);
4321 res = RegSetValueExA(hklm, "Value9", 0, REG_SZ,
4322 (const BYTE *)path, lstrlenA(path) + 1);
4323 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4324
4325 sprintf(path, "%s\\FileName2", expected);
4326 res = RegSetValueExA(hklm, "Value10", 0, REG_SZ,
4327 (const BYTE *)path, lstrlenA(path) + 1);
4328 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4329
4331 res = RegSetValueExA(hklm, "Value11", 0, REG_SZ,
4332 (const BYTE *)path, lstrlenA(path) + 1);
4333 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4334
4335 res = RegSetValueExA(hklm, "Value12", 0, REG_SZ,
4336 (const BYTE *)"", 1);
4337 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4338
4339 create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
4340 sprintf(path, "%s\\FileName3.dll", expected);
4341 res = RegSetValueExA(hklm, "Value13", 0, REG_SZ,
4342 (const BYTE *)path, lstrlenA(path) + 1);
4343 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4344
4345 create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
4346 sprintf(path, "%s\\FileName4.dll", expected);
4347 res = RegSetValueExA(hklm, "Value14", 0, REG_SZ,
4348 (const BYTE *)path, lstrlenA(path) + 1);
4349 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4350
4351 create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
4352 sprintf(path, "%s\\FileName5.dll", expected);
4353 res = RegSetValueExA(hklm, "Value15", 0, REG_SZ,
4354 (const BYTE *)path, lstrlenA(path) + 1);
4355 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4356
4357 sprintf(path, "\"%s\\FileName1\" -option", expected);
4358 res = RegSetValueExA(hklm, "value16", 0, REG_SZ,
4359 (const BYTE *)path, lstrlenA(path) + 1);
4360 ok( res == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %ld\n", res);
4361
4362 space = strchr(expected, ' ') != NULL;
4363 sprintf(path, "%s\\FileName1 -option", expected);
4364 res = RegSetValueExA(hklm, "value17", 0, REG_SZ,
4365 (const BYTE *)path, lstrlenA(path) + 1);
4366 ok( res == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %ld\n", res);
4367
4368 hdb = create_package_db();
4369 ok(hdb, "Expected a valid database handle\n");
4370
4372 add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
4373 add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
4374 add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
4375 add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
4376 add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
4377 add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
4378 add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
4379 add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
4380 add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
4381 add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
4382 add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
4383 add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
4384 add_appsearch_entry(hdb, "'SIGPROP13', 'NewSignature13'");
4385 add_appsearch_entry(hdb, "'SIGPROP14', 'NewSignature14'");
4386 add_appsearch_entry(hdb, "'SIGPROP15', 'NewSignature15'");
4387 add_appsearch_entry(hdb, "'SIGPROP16', 'NewSignature16'");
4388 add_appsearch_entry(hdb, "'SIGPROP17', 'NewSignature17'");
4389 add_appsearch_entry(hdb, "'SIGPROP18', 'NewSignature18'");
4390 add_appsearch_entry(hdb, "'SIGPROP19', 'NewSignature19'");
4391 add_appsearch_entry(hdb, "'SIGPROP20', 'NewSignature20'");
4392 add_appsearch_entry(hdb, "'SIGPROP21', 'NewSignature21'");
4393 add_appsearch_entry(hdb, "'SIGPROP22', 'NewSignature22'");
4394 add_appsearch_entry(hdb, "'SIGPROP23', 'NewSignature23'");
4395 add_appsearch_entry(hdb, "'SIGPROP24', 'NewSignature24'");
4396 add_appsearch_entry(hdb, "'SIGPROP25', 'NewSignature25'");
4397 add_appsearch_entry(hdb, "'SIGPROP26', 'NewSignature26'");
4398 add_appsearch_entry(hdb, "'SIGPROP27', 'NewSignature27'");
4399 add_appsearch_entry(hdb, "'SIGPROP28', 'NewSignature28'");
4400 add_appsearch_entry(hdb, "'SIGPROP29', 'NewSignature29'");
4401 add_appsearch_entry(hdb, "'SIGPROP30', 'NewSignature30'");
4402
4404
4406 if (is_64bit)
4408
4409 /* HKLM, msidbLocatorTypeRawValue, REG_SZ */
4410 add_reglocator_entry(hdb, "NewSignature1", 2, "Software\\Wine", "Value1", type);
4411
4412 /* HKLM, msidbLocatorTypeRawValue, positive DWORD */
4413 add_reglocator_entry(hdb, "NewSignature2", 2, "Software\\Wine", "Value2", type);
4414
4415 /* HKLM, msidbLocatorTypeRawValue, negative DWORD */
4416 add_reglocator_entry(hdb, "NewSignature3", 2, "Software\\Wine", "Value3", type);
4417
4418 /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
4419 add_reglocator_entry(hdb, "NewSignature4", 2, "Software\\Wine", "Value4", type);
4420
4421 /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
4422 add_reglocator_entry(hdb, "NewSignature5", 2, "Software\\Wine", "Value5", type);
4423
4424 /* HKLM, msidbLocatorTypeRawValue, REG_MULTI_SZ */
4425 add_reglocator_entry(hdb, "NewSignature6", 2, "Software\\Wine", "Value6", type);
4426
4427 /* HKLM, msidbLocatorTypeRawValue, REG_BINARY */
4428 add_reglocator_entry(hdb, "NewSignature7", 2, "Software\\Wine", "Value7", type);
4429
4430 /* HKLM, msidbLocatorTypeRawValue, REG_SZ first char is # */
4431 add_reglocator_entry(hdb, "NewSignature8", 2, "Software\\Wine", "Value8", type);
4432
4434 if (is_64bit)
4436
4437 /* HKLM, msidbLocatorTypeFileName, signature, file exists */
4438 add_reglocator_entry(hdb, "NewSignature9", 2, "Software\\Wine", "Value9", type);
4439
4440 /* HKLM, msidbLocatorTypeFileName, signature, file does not exist */
4441 add_reglocator_entry(hdb, "NewSignature10", 2, "Software\\Wine", "Value10", type);
4442
4443 /* HKLM, msidbLocatorTypeFileName, no signature */
4444 add_reglocator_entry(hdb, "NewSignature11", 2, "Software\\Wine", "Value9", type);
4445
4447 if (is_64bit)
4449
4450 /* HKLM, msidbLocatorTypeDirectory, no signature, file exists */
4451 add_reglocator_entry(hdb, "NewSignature12", 2, "Software\\Wine", "Value9", type);
4452
4453 /* HKLM, msidbLocatorTypeDirectory, no signature, directory exists */
4454 add_reglocator_entry(hdb, "NewSignature13", 2, "Software\\Wine", "Value11", type);
4455
4456 /* HKLM, msidbLocatorTypeDirectory, signature, file exists */
4457 add_reglocator_entry(hdb, "NewSignature14", 2, "Software\\Wine", "Value9", type);
4458
4460 if (is_64bit)
4462
4463 /* HKCR, msidbLocatorTypeRawValue, REG_SZ */
4464 add_reglocator_entry(hdb, "NewSignature15", 0, "Software\\Wine", "Value1", type);
4465
4466 /* HKCU, msidbLocatorTypeRawValue, REG_SZ */
4467 add_reglocator_entry(hdb, "NewSignature16", 1, "Software\\Wine", "Value1", type);
4468
4469 /* HKU, msidbLocatorTypeRawValue, REG_SZ */
4470 add_reglocator_entry(hdb, "NewSignature17", 3, "S-1-5-18\\Software\\Wine", "Value1", type);
4471
4472 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, NULL Name */
4473 add_reglocator_entry(hdb, "NewSignature18", 2, "Software\\Wine", "", type);
4474
4475 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, key does not exist */
4476 add_reglocator_entry(hdb, "NewSignature19", 2, "Software\\IDontExist", "", type);
4477
4478 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, value is empty */
4479 add_reglocator_entry(hdb, "NewSignature20", 2, "Software\\Wine", "Value12", type);
4480
4482 if (is_64bit)
4484
4485 /* HKLM, msidbLocatorTypeFileName, signature, file exists w/ version */
4486 add_reglocator_entry(hdb, "NewSignature21", 2, "Software\\Wine", "Value13", type);
4487
4488 /* HKLM, msidbLocatorTypeFileName, file exists w/ version, version > max */
4489 add_reglocator_entry(hdb, "NewSignature22", 2, "Software\\Wine", "Value14", type);
4490
4491 /* HKLM, msidbLocatorTypeFileName, file exists w/ version, sig->name ignored */
4492 add_reglocator_entry(hdb, "NewSignature23", 2, "Software\\Wine", "Value15", type);
4493
4494 /* HKLM, msidbLocatorTypeFileName, no signature, directory exists */
4495 add_reglocator_entry(hdb, "NewSignature24", 2, "Software\\Wine", "Value11", type);
4496
4497 /* HKLM, msidbLocatorTypeFileName, no signature, file does not exist */
4498 add_reglocator_entry(hdb, "NewSignature25", 2, "Software\\Wine", "Value10", type);
4499
4501 if (is_64bit)
4503
4504 /* HKLM, msidbLocatorTypeDirectory, signature, directory exists */
4505 add_reglocator_entry(hdb, "NewSignature26", 2, "Software\\Wine", "Value11", type);
4506
4507 /* HKLM, msidbLocatorTypeDirectory, signature, file does not exist */
4508 add_reglocator_entry(hdb, "NewSignature27", 2, "Software\\Wine", "Value10", type);
4509
4510 /* HKLM, msidbLocatorTypeDirectory, no signature, file does not exist */
4511 add_reglocator_entry(hdb, "NewSignature28", 2, "Software\\Wine", "Value10", type);
4512
4514 if (is_64bit)
4516
4517 /* HKLM, msidbLocatorTypeFile, file exists, in quotes */
4518 add_reglocator_entry(hdb, "NewSignature29", 2, "Software\\Wine", "Value16", type);
4519
4520 /* HKLM, msidbLocatorTypeFile, file exists, no quotes */
4521 add_reglocator_entry(hdb, "NewSignature30", 2, "Software\\Wine", "Value17", type);
4522
4524 add_signature_entry(hdb, "'NewSignature9', 'FileName1', '', '', '', '', '', '', ''");
4525 add_signature_entry(hdb, "'NewSignature10', 'FileName2', '', '', '', '', '', '', ''");
4526 add_signature_entry(hdb, "'NewSignature14', 'FileName1', '', '', '', '', '', '', ''");
4527 add_signature_entry(hdb, "'NewSignature21', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
4528 add_signature_entry(hdb, "'NewSignature22', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
4529 add_signature_entry(hdb, "'NewSignature23', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
4530
4531 if (!is_root(CURR_DIR))
4532 {
4533 ptr = strrchr(expected, '\\') + 1;
4534 sprintf(path, "'NewSignature26', '%s', '', '', '', '', '', '', ''", ptr);
4536 }
4537 add_signature_entry(hdb, "'NewSignature27', 'FileName2', '', '', '', '', '', '', ''");
4538 add_signature_entry(hdb, "'NewSignature29', 'FileName1', '', '', '', '', '', '', ''");
4539 add_signature_entry(hdb, "'NewSignature30', 'FileName1', '', '', '', '', '', '', ''");
4540
4541 r =