ReactOS  0.4.15-dev-4594-g505ac65
action.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <msiquery.h>
#include <msidefs.h>
#include <msi.h>
#include <fci.h>
#include <srrestoreptapi.h>
#include <wtypes.h>
#include <shellapi.h>
#include <winsvc.h>
#include <odbcinst.h>
#include <sddl.h>
#include "wine/test.h"
#include "utils.h"
#include "typelib.h"
Include dependency graph for action.c:

Go to the source code of this file.

Macros

#define _WIN32_MSI   300
 
#define COBJMACROS
 
#define MEDIA_SIZE   0x7FFFFFFF
 
#define GET_PROC(mod, func)
 
#define CHECK_REG_STR(prodkey, name, expected)   check_reg_str(prodkey, name, expected, TRUE, FALSE, __LINE__);
 
#define CHECK_DEL_REG_STR(prodkey, name, expected)
 
#define CHECK_DEL_REG_STR_TODO(prodkey, name, expected)
 
#define CHECK_REG_ISTR(prodkey, name, expected)   check_reg_str(prodkey, name, expected, FALSE, FALSE, __LINE__);
 
#define CHECK_DEL_REG_ISTR(prodkey, name, expected)
 
#define CHECK_REG_MULTI(key, name, expect)   check_reg_multi(key, name, expect, __LINE__);
 
#define CHECK_DEL_REG_MULTI(key, name, expect)
 
#define CHECK_REG_DWORD(prodkey, name, expected)   check_reg_dword(prodkey, name, expected, FALSE, __LINE__);
 
#define CHECK_REG_DWORD_TODO(prodkey, name, expected)   check_reg_dword(prodkey, name, expected, TRUE, __LINE__);
 
#define CHECK_DEL_REG_DWORD(prodkey, name, expected)
 
#define CHECK_DEL_REG_DWORD_TODO(prodkey, name, expected)
 

Functions

static UINT (WINAPI *pMsiQueryComponentStateA)(LPCSTR
 
static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)(LPCSTR
 
static INSTALLSTATE *static LONG (WINAPI *pRegDeleteKeyExA)(HKEY
 
static BOOL (WINAPI *pIsWow64Process)(HANDLE
 
static void init_functionpointers (void)
 
static charget_user_sid (void)
 
static void create_test_files (void)
 
static void delete_test_files (void)
 
static BOOL notify_system_change (DWORD event_type, STATEMGRSTATUS *status)
 
static void remove_restore_point (DWORD seq_number)
 
static LONG delete_key (HKEY key, LPCSTR subkey, REGSAM access)
 
static void delete_pfmsitest_files (void)
 
static void check_reg_str (HKEY prodkey, LPCSTR name, LPCSTR expected, BOOL bcase, BOOL todo, DWORD line)
 
static void check_reg_multi (HKEY prodkey, const char *name, const char *expect, DWORD line)
 
static void check_reg_dword (HKEY prodkey, LPCSTR name, DWORD expected, BOOL todo, DWORD line)
 
static void get_date_str (LPSTR date)
 
static DWORD get_estimated_size (void)
 
static void extract_resource (const char *name, const char *type, const char *path)
 
static void test_register_product (void)
 
static void test_publish_product (void)
 
static void test_publish_features (void)
 
static LPSTR reg_get_val_str (HKEY hkey, LPCSTR name)
 
static void get_owner_company (LPSTR *owner, LPSTR *company)
 
static void test_register_user (void)
 
static void test_process_components (void)
 
static void test_publish (void)
 
static void test_publish_sourcelist (void)
 
static void test_remove_files (void)
 
static void test_move_files (void)
 
static void test_duplicate_files (void)
 
static void test_write_registry_values (void)
 
static void test_envvar (void)
 
static void test_create_remove_folder (void)
 
static void test_start_stop_services (void)
 
static void delete_test_service (const char *name)
 
static void test_delete_services (void)
 
static void test_install_services (void)
 
static void test_self_registration (void)
 
static void test_register_font (void)
 
static void test_validate_product_id (void)
 
static void test_install_remove_odbc (void)
 
static void test_register_typelib (void)
 
static void test_create_remove_shortcut (void)
 
static void test_publish_components (void)
 
static void test_remove_duplicate_files (void)
 
static void test_find_related_products (void)
 
static void test_ini_values (void)
 
static void test_register_class_info (void)
 
static void test_register_extension_info (void)
 
static void test_register_progid_info (void)
 
static void test_register_mime_info (void)
 
static void test_publish_assemblies (void)
 
static void test_remove_existing_products (void)
 
 START_TEST (action)
 

Variables

static LPCSTR
 
static MSIINSTALLCONTEXT
 
static INSTALLSTATE *static DWORD
 
static INSTALLSTATE *static LPSTR
 
static INSTALLSTATE *static LPDWORD
 
static INSTALLSTATE *static REGSAM
 
static PBOOL
 
static STATEMGRSTATUS *static BOOL is_wow64
 
static const BOOL is_64bit = sizeof(void *) > sizeof(int)
 
static const charmsifile = "msitest.msi"
 
static const char component_dat []
 
static const char directory_dat []
 
static const char feature_dat []
 
static const char feature_comp_dat []
 
static const char file_dat []
 
static const char install_exec_seq_dat []
 
static const char media_dat []
 
static const char property_dat []
 
static const char env_install_exec_seq_dat []
 
static const char env_custom_action_dat []
 
static const char env_environment_dat []
 
static const char service_install_dat []
 
static const char service_install2_dat []
 
static const char service_control_dat []
 
static const char sss_service_control_dat []
 
static const char sss_install_exec_seq_dat []
 
static const char sss_custom_action_dat []
 
static const char sds_install_exec_seq_dat []
 
static const char sds_custom_action_dat []
 
static const char sis_install_exec_seq_dat []
 
static const char sis_custom_action_dat []
 
static const char rof_component_dat []
 
static const char rof_feature_dat []
 
static const char rof_feature_comp_dat []
 
static const char rof_file_dat []
 
static const char rof_media_dat []
 
static const char ci2_feature_comp_dat []
 
static const char ci2_file_dat []
 
static const char pp_install_exec_seq_dat []
 
static const char pp_custom_action_dat []
 
static const char pp_component_dat []
 
static const char ppc_component_dat []
 
static const char ppc_file_dat []
 
static const char ppc_media_dat []
 
static const char ppc_feature_comp_dat []
 
static const char cwd_component_dat []
 
static const char rem_component_dat []
 
static const char rem_feature_comp_dat []
 
static const char rem_file_dat []
 
static const char rem_install_exec_seq_dat []
 
static const char rem_remove_files_dat []
 
static const char mov_move_file_dat []
 
static const char mov_install_exec_seq_dat []
 
static const char mov_custom_action_dat []
 
static const char df_directory_dat []
 
static const char df_duplicate_file_dat []
 
static const char wrv_component_dat []
 
static const char wrv_feature_dat []
 
static const char wrv_feature_comp_dat []
 
static const char wrv_registry_dat []
 
static const char wrv_remove_registry_dat []
 
static const char wrv_install_exec_seq_dat []
 
static const char wrv_custom_action_dat []
 
static const char cf_directory_dat []
 
static const char cf_component_dat []
 
static const char cf_feature_dat []
 
static const char cf_feature_comp_dat []
 
static const char cf_file_dat []
 
static const char cf_create_folders_dat []
 
static const char cf_install_exec_seq_dat []
 
static const char cf_custom_action_dat []
 
static const char sr_file_dat []
 
static const char sr_feature_dat []
 
static const char sr_feature_comp_dat []
 
static const char sr_component_dat []
 
static const char sr_selfreg_dat []
 
static const char sr_install_exec_seq_dat []
 
static const char sr_custom_action_dat []
 
static const char font_media_dat []
 
static const char font_file_dat []
 
static const char font_feature_dat []
 
static const char font_component_dat []
 
static const char font_feature_comp_dat []
 
static const char font_dat []
 
static const char font_install_exec_seq_dat []
 
static const char font_custom_action_dat []
 
static const char vp_property_dat []
 
static const char vp_custom_action_dat []
 
static const char vp_install_exec_seq_dat []
 
static const char odbc_file_dat []
 
static const char odbc_feature_dat []
 
static const char odbc_feature_comp_dat []
 
static const char odbc_component_dat []
 
static const char odbc_driver_dat []
 
static const char odbc_translator_dat []
 
static const char odbc_datasource_dat []
 
static const char odbc_install_exec_seq_dat []
 
static const char odbc_custom_action_dat []
 
static const char odbc_media_dat []
 
static const char tl_file_dat []
 
static const char tl_feature_dat []
 
static const char tl_feature_comp_dat []
 
static const char tl_component_dat []
 
static const char tl_typelib_dat []
 
static const char tl_install_exec_seq_dat []
 
static const char tl_custom_action_dat []
 
static const char crs_file_dat []
 
static const char crs_feature_dat []
 
static const char crs_feature_comp_dat []
 
static const char crs_component_dat []
 
static const char crs_shortcut_dat []
 
static const char crs_install_exec_seq_dat []
 
static const char crs_custom_action_dat []
 
static const char pub_file_dat []
 
static const char pub_feature_dat []
 
static const char pub_feature_comp_dat []
 
static const char pub_component_dat []
 
static const char pub_publish_component_dat []
 
static const char pub_install_exec_seq_dat []
 
static const char pub_custom_action_dat []
 
static const char rd_file_dat []
 
static const char rd_feature_dat []
 
static const char rd_feature_comp_dat []
 
static const char rd_component_dat []
 
static const char rd_duplicate_file_dat []
 
static const char rd_install_exec_seq_dat []
 
static const char rd_custom_action_dat []
 
static const char frp_file_dat []
 
static const char frp_feature_dat []
 
static const char frp_feature_comp_dat []
 
static const char frp_component_dat []
 
static const char frp_custom_action_dat []
 
static const char frp_upgrade_dat []
 
static const char frp_install_exec_seq_dat []
 
static const char ini_file_dat []
 
static const char ini_feature_dat []
 
static const char ini_feature_comp_dat []
 
static const char ini_component_dat []
 
static const char ini_ini_file_dat []
 
static const char ini_remove_ini_file_dat []
 
static const char ini_install_exec_seq_dat []
 
static const char ini_custom_action_dat []
 
static const char rci_file_dat []
 
static const char rci_feature_dat []
 
static const char rci_feature_comp_dat []
 
static const char rci_component_dat []
 
static const char rci_appid_dat []
 
static const char rci_class_dat []
 
static const char rci_install_exec_seq_dat []
 
static const char rci_custom_action_dat []
 
static const char rei_file_dat []
 
static const char rei_feature_dat []
 
static const char rei_feature_comp_dat []
 
static const char rei_component_dat []
 
static const char rei_extension_dat []
 
static const char rei_verb_dat []
 
static const char rei_progid_dat []
 
static const char rei_install_exec_seq_dat []
 
static const char rei_custom_action_dat []
 
static const char rpi_file_dat []
 
static const char rpi_feature_dat []
 
static const char rpi_feature_comp_dat []
 
static const char rpi_component_dat []
 
static const char rpi_appid_dat []
 
static const char rpi_class_dat []
 
static const char rpi_extension_dat []
 
static const char rpi_verb_dat []
 
static const char rpi_progid_dat []
 
static const char rpi_install_exec_seq_dat []
 
static const char rpi_custom_action_dat []
 
static const char rmi_file_dat []
 
static const char rmi_feature_dat []
 
static const char rmi_feature_comp_dat []
 
static const char rmi_component_dat []
 
static const char rmi_extension_dat []
 
static const char rmi_verb_dat []
 
static const char rmi_mime_dat []
 
static const char rmi_install_exec_seq_dat []
 
static const char rmi_custom_action_dat []
 
static const char pa_file_dat []
 
static const char pa_feature_dat []
 
static const char pa_feature_comp_dat []
 
static const char pa_component_dat []
 
static const char pa_msi_assembly_dat []
 
static const char pa_msi_assembly_name_dat []
 
static const char pa_install_exec_seq_dat []
 
static const char pa_custom_action_dat []
 
static const char rep_file_dat []
 
static const char rep_feature_dat []
 
static const char rep_feature_comp_dat []
 
static const char rep_component_dat []
 
static const char rep_upgrade_dat []
 
static const char rep_property_dat []
 
static const char rep_install_exec_seq_dat []
 
static const msi_table env_tables []
 
static const msi_table pp_tables []
 
static const msi_table ppc_tables []
 
static const msi_table rem_tables []
 
static const msi_table mov_tables []
 
static const msi_table df_tables []
 
static const msi_table wrv_tables []
 
static const msi_table cf_tables []
 
static const msi_table sss_tables []
 
static const msi_table sds_tables []
 
static const msi_table sis_tables []
 
static const msi_table sr_tables []
 
static const msi_table font_tables []
 
static const msi_table vp_tables []
 
static const msi_table odbc_tables []
 
static const msi_table tl_tables []
 
static const msi_table crs_tables []
 
static const msi_table pub_tables []
 
static const msi_table rd_tables []
 
static const msi_table frp_tables []
 
static const msi_table ini_tables []
 
static const msi_table rci_tables []
 
static const msi_table rei_tables []
 
static const msi_table rpi_tables []
 
static const msi_table rmi_tables []
 
static const msi_table pa_tables []
 
static const msi_table rep_tables []
 

Macro Definition Documentation

◆ _WIN32_MSI

#define _WIN32_MSI   300

Definition at line 22 of file action.c.

◆ CHECK_DEL_REG_DWORD

#define CHECK_DEL_REG_DWORD (   prodkey,
  name,
  expected 
)
Value:
do { \
check_reg_dword(prodkey, name, expected, FALSE, __LINE__); \
RegDeleteValueA(prodkey, name); \
} while(0)
#define FALSE
Definition: types.h:117
Definition: name.c:38
BOOL expected
Definition: store.c:2063

Definition at line 2602 of file action.c.

◆ CHECK_DEL_REG_DWORD_TODO

#define CHECK_DEL_REG_DWORD_TODO (   prodkey,
  name,
  expected 
)
Value:
do { \
check_reg_dword(prodkey, name, expected, TRUE, __LINE__); \
RegDeleteValueA(prodkey, name); \
} while(0)
#define TRUE
Definition: types.h:120
Definition: name.c:38
BOOL expected
Definition: store.c:2063

Definition at line 2608 of file action.c.

◆ CHECK_DEL_REG_ISTR

#define CHECK_DEL_REG_ISTR (   prodkey,
  name,
  expected 
)
Value:
do { \
check_reg_str(prodkey, name, expected, FALSE, FALSE, __LINE__); \
RegDeleteValueA(prodkey, name); \
} while(0)
#define FALSE
Definition: types.h:117
Definition: name.c:38
BOOL expected
Definition: store.c:2063

Definition at line 2581 of file action.c.

◆ CHECK_DEL_REG_MULTI

#define CHECK_DEL_REG_MULTI (   key,
  name,
  expect 
)
Value:
do { \
check_reg_multi(key, name, expect, __LINE__); \
RegDeleteValueA(key, name); \
} while(0)
#define expect(expected, got)
Definition: combo.c:36
Definition: name.c:38
Definition: path.c:41

Definition at line 2590 of file action.c.

◆ CHECK_DEL_REG_STR

#define CHECK_DEL_REG_STR (   prodkey,
  name,
  expected 
)
Value:
do { \
check_reg_str(prodkey, name, expected, TRUE, FALSE, __LINE__); \
RegDeleteValueA(prodkey, name); \
} while(0)
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
Definition: name.c:38
BOOL expected
Definition: store.c:2063

Definition at line 2566 of file action.c.

◆ CHECK_DEL_REG_STR_TODO

#define CHECK_DEL_REG_STR_TODO (   prodkey,
  name,
  expected 
)
Value:
do { \
check_reg_str(prodkey, name, expected, TRUE, TRUE, __LINE__); \
RegDeleteValueA(prodkey, name); \
} while(0)
#define TRUE
Definition: types.h:120
Definition: name.c:38
BOOL expected
Definition: store.c:2063

Definition at line 2572 of file action.c.

◆ CHECK_REG_DWORD

#define CHECK_REG_DWORD (   prodkey,
  name,
  expected 
)    check_reg_dword(prodkey, name, expected, FALSE, __LINE__);

Definition at line 2596 of file action.c.

◆ CHECK_REG_DWORD_TODO

#define CHECK_REG_DWORD_TODO (   prodkey,
  name,
  expected 
)    check_reg_dword(prodkey, name, expected, TRUE, __LINE__);

Definition at line 2599 of file action.c.

◆ CHECK_REG_ISTR

#define CHECK_REG_ISTR (   prodkey,
  name,
  expected 
)    check_reg_str(prodkey, name, expected, FALSE, FALSE, __LINE__);

Definition at line 2578 of file action.c.

◆ CHECK_REG_MULTI

#define CHECK_REG_MULTI (   key,
  name,
  expect 
)    check_reg_multi(key, name, expect, __LINE__);

Definition at line 2587 of file action.c.

◆ CHECK_REG_STR

#define CHECK_REG_STR (   prodkey,
  name,
  expected 
)    check_reg_str(prodkey, name, expected, TRUE, FALSE, __LINE__);

Definition at line 2563 of file action.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 26 of file action.c.

◆ GET_PROC

#define GET_PROC (   mod,
  func 
)
Value:
p ## func = (void*)GetProcAddress(mod, #func); \
if(!p ## func) \
trace("GetProcAddress(%s) failed\n", #func);
GLenum func
Definition: glext.h:6028
#define GetProcAddress(x, y)
Definition: compat.h:612
GLfloat GLfloat p
Definition: glext.h:8902
static int mod
Definition: i386-dis.c:1281

◆ MEDIA_SIZE

#define MEDIA_SIZE   0x7FFFFFFF

Definition at line 2376 of file action.c.

Function Documentation

◆ BOOL()

static BOOL ( WINAPI pIsWow64Process)
static

◆ check_reg_dword()

static void check_reg_dword ( HKEY  prodkey,
LPCSTR  name,
DWORD  expected,
BOOL  todo,
DWORD  line 
)
static

Definition at line 2550 of file action.c.

2551 {
2552  DWORD val, size, type;
2553  LONG res;
2554 
2555  size = sizeof(DWORD);
2556  res = RegQueryValueExA(prodkey, name, NULL, &type, (BYTE *)&val, &size);
2557  ok_(__FILE__, line)(!res, "Failed to query value, error %ld\n", res);
2558  ok_(__FILE__, line)(type == REG_DWORD, "Got wrong type %lu\n", type);
2559  todo_wine_if (todo)
2560  ok_(__FILE__, line)(val == expected, "Expected %lu, got %lu\n", expected, val);
2561 }
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4027
BOOL todo
Definition: filedlg.c:313
long LONG
Definition: pedump.c:60
Definition: parser.c:48
GLuint GLfloat * val
Definition: glext.h:7180
GLsizeiptr size
Definition: glext.h:5919
#define todo_wine_if(is_todo)
Definition: custom.c:76
unsigned long DWORD
Definition: ntddk_ex.h:95
static INSTALLSTATE *static DWORD
Definition: action.c:49
unsigned char BYTE
Definition: xxhash.c:193
#define NULL
Definition: types.h:112
Definition: name.c:38
GLuint res
Definition: glext.h:9613
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define REG_DWORD
Definition: sdbapi.c:596
BOOL expected
Definition: store.c:2063
#define ok_(x1, x2)
Definition: atltest.h:61

◆ check_reg_multi()

static void check_reg_multi ( HKEY  prodkey,
const char name,
const char expect,
DWORD  line 
)
static

Definition at line 2530 of file action.c.

2531 {
2532  char val[MAX_PATH];
2533  DWORD expect_size = 0, size, type;
2534  const char *p;
2535  LONG res;
2536 
2537  for (p = expect; *p; p += strlen(p) + 1)
2538  ;
2539  expect_size = (p + 1) - expect;
2540 
2541  size = MAX_PATH;
2542  val[0] = '\0';
2543  res = RegQueryValueExA(prodkey, name, NULL, &type, (BYTE *)val, &size);
2544  ok_(__FILE__, line)(!res, "Failed to query value, error %ld\n", res);
2545  ok_(__FILE__, line)(type == REG_MULTI_SZ, "Got wrong type %lu\n", type);
2546  ok_(__FILE__, line)(size == expect_size, "expected size %lu, got %lu\n", expect_size, size);
2547  ok_(__FILE__, line)(!memcmp(val, expect, size), "got %s\n", debugstr_an(val, size));
2548 }
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4027
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
long LONG
Definition: pedump.c:60
#define REG_MULTI_SZ
Definition: nt_native.h:1501
Definition: parser.c:48
GLuint GLfloat * val
Definition: glext.h:7180
GLsizeiptr size
Definition: glext.h:5919
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:55
unsigned char BYTE
Definition: xxhash.c:193
#define expect(expected, got)
Definition: combo.c:36
#define NULL
Definition: types.h:112
Definition: name.c:38
GLuint res
Definition: glext.h:9613
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLfloat GLfloat p
Definition: glext.h:8902
#define ok_(x1, x2)
Definition: atltest.h:61

◆ check_reg_str()

static void check_reg_str ( HKEY  prodkey,
LPCSTR  name,
LPCSTR  expected,
BOOL  bcase,
BOOL  todo,
DWORD  line 
)
static

Definition at line 2510 of file action.c.

2511 {
2512  char val[MAX_PATH];
2513  DWORD size, type;
2514  LONG res;
2515 
2516  size = MAX_PATH;
2517  val[0] = '\0';
2518  res = RegQueryValueExA(prodkey, name, NULL, &type, (BYTE *)val, &size);
2519  ok_(__FILE__, line)(!res, "Failed to query value, error %ld\n", res);
2520  ok_(__FILE__, line)(type == REG_SZ || type == REG_EXPAND_SZ, "Got wrong type %lu\n", type);
2521  todo_wine_if (todo)
2522  {
2523  if (bcase)
2524  ok_(__FILE__, line)(!strcmp(val, expected), "got %s\n", debugstr_a(val));
2525  else
2526  ok_(__FILE__, line)(!strcasecmp(val, expected), "got %s\n", debugstr_a(val));
2527  }
2528 }
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4027
#define strcasecmp
Definition: fake.h:9
BOOL todo
Definition: filedlg.c:313
long LONG
Definition: pedump.c:60
Definition: parser.c:48
GLuint GLfloat * val
Definition: glext.h:7180
GLsizeiptr size
Definition: glext.h:5919
#define debugstr_a
Definition: kernel32.h:31
#define todo_wine_if(is_todo)
Definition: custom.c:76
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned char BYTE
Definition: xxhash.c:193
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define NULL
Definition: types.h:112
Definition: name.c:38
GLuint res
Definition: glext.h:9613
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
BOOL expected
Definition: store.c:2063
#define ok_(x1, x2)
Definition: atltest.h:61
#define REG_SZ
Definition: layer.c:22

◆ create_test_files()

static void create_test_files ( void  )
static

Definition at line 2424 of file action.c.

2425 {
2426  CreateDirectoryA("msitest", NULL);
2427  create_file("msitest\\one.txt", 100);
2428  CreateDirectoryA("msitest\\first", NULL);
2429  create_file("msitest\\first\\two.txt", 100);
2430  CreateDirectoryA("msitest\\second", NULL);
2431  create_file("msitest\\second\\three.txt", 100);
2432 
2433  create_file("four.txt", 100);
2434  create_file("five.txt", 100);
2435  create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
2436 
2437  create_file("msitest\\filename", 100);
2438  create_file("msitest\\service.exe", 100);
2439  create_file("msitest\\service2.exe", 100);
2440 
2441  DeleteFileA("four.txt");
2442  DeleteFileA("five.txt");
2443 }
#define MEDIA_SIZE
Definition: action.c:2376
#define create_file(name, size)
Definition: asmcache.c:813
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
static void create_cab_file(void)
Definition: files.c:356
#define NULL
Definition: types.h:112

Referenced by test_create_remove_shortcut(), test_delete_services(), test_find_related_products(), test_ini_values(), test_install_remove_odbc(), test_install_services(), test_publish_assemblies(), test_publish_components(), test_register_class_info(), test_register_extension_info(), test_register_font(), test_register_mime_info(), test_register_progid_info(), test_register_typelib(), test_remove_duplicate_files(), test_remove_existing_products(), test_self_registration(), test_start_stop_services(), and test_validate_product_id().

◆ delete_key()

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

Definition at line 2481 of file action.c.

2482 {
2483  if (pRegDeleteKeyExA)
2484  return pRegDeleteKeyExA( key, subkey, access, 0 );
2485  return RegDeleteKeyA( key, subkey );
2486 }
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1222
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
Definition: path.c:41

Referenced by test_process_components(), test_publish_features(), test_publish_product(), and test_register_user().

◆ delete_pfmsitest_files()

static void delete_pfmsitest_files ( void  )
static

Definition at line 2488 of file action.c.

2489 {
2490  SHFILEOPSTRUCTA shfl;
2491  CHAR path[MAX_PATH+11];
2492 
2494  lstrcatA(path, "\\msitest\\*");
2495  path[strlen(path) + 1] = '\0';
2496 
2497  shfl.hwnd = NULL;
2498  shfl.wFunc = FO_DELETE;
2499  shfl.pFrom = path;
2500  shfl.pTo = NULL;
2502 
2503  SHFileOperationA(&shfl);
2504 
2506  lstrcatA(path, "\\msitest");
2508 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLsizei const GLchar ** path
Definition: glext.h:7234
FILEOP_FLAGS fFlags
Definition: shellapi.h:347
#define FOF_SILENT
Definition: shellapi.h:140
static char PROG_FILES_DIR[MAX_PATH]
Definition: automation.c:362
char CHAR
Definition: xmlstorage.h:175
#define FOF_NOERRORUI
Definition: shellapi.h:148
#define FOF_NOCONFIRMATION
Definition: shellapi.h:142
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
#define FOF_NORECURSION
Definition: shlfileop.c:38
#define FOF_FILESONLY
Definition: shellapi.h:145
#define MAX_PATH
Definition: compat.h:34
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
#define NULL
Definition: types.h:112
int WINAPI SHFileOperationA(LPSHFILEOPSTRUCTA lpFileOp)
Definition: shlfileop.cpp:1069
#define FO_DELETE
Definition: shellapi.h:135

Referenced by test_publish(), and test_publish_sourcelist().

◆ delete_test_files()

static void delete_test_files ( void  )
static

Definition at line 2445 of file action.c.

2446 {
2447  DeleteFileA("msitest.msi");
2448  DeleteFileA("msitest.cab");
2449  DeleteFileA("msitest\\second\\three.txt");
2450  DeleteFileA("msitest\\first\\two.txt");
2451  DeleteFileA("msitest\\one.txt");
2452  DeleteFileA("msitest\\service.exe");
2453  DeleteFileA("msitest\\service2.exe");
2454  DeleteFileA("msitest\\filename");
2455  RemoveDirectoryA("msitest\\second");
2456  RemoveDirectoryA("msitest\\first");
2457  RemoveDirectoryA("msitest");
2458 }
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714

Referenced by test_create_remove_shortcut(), test_delete_services(), test_find_related_products(), test_ini_values(), test_install_remove_odbc(), test_install_services(), test_publish_assemblies(), test_publish_components(), test_register_class_info(), test_register_extension_info(), test_register_font(), test_register_mime_info(), test_register_progid_info(), test_register_typelib(), test_remove_duplicate_files(), test_remove_existing_products(), test_self_registration(), test_start_stop_services(), and test_validate_product_id().

◆ delete_test_service()

static void delete_test_service ( const char name)
static

Definition at line 5246 of file action.c.

5247 {
5248  BOOL ret;
5249  SC_HANDLE manager, service;
5250 
5252  ok(manager != NULL, "can't open service manager\n");
5253  if (!manager) return;
5254 
5255  service = OpenServiceA(manager, name, GENERIC_ALL);
5256  if (service)
5257  {
5258  ret = DeleteService( service );
5259  ok( ret, "failed to delete service %lu\n", GetLastError() );
5260  CloseServiceHandle(service);
5261  }
5262  CloseServiceHandle(manager);
5263 }
#define GENERIC_ALL
Definition: nt_native.h:92
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
BOOL WINAPI DeleteService(SC_HANDLE hService)
Definition: scm.c:921
SC_HANDLE WINAPI OpenSCManagerA(LPCSTR lpMachineName, LPCSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:1972
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:580
int ret
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define SC_MANAGER_ALL_ACCESS
Definition: winsvc.h:13
SC_HANDLE WINAPI OpenServiceA(SC_HANDLE hSCManager, LPCSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:2060
Definition: name.c:38

Referenced by test_delete_services(), and test_install_services().

◆ extract_resource()

static void extract_resource ( const char name,
const char type,
const char path 
)
static

Definition at line 2639 of file action.c.

2640 {
2641  DWORD written;
2642  HANDLE file;
2643  HRSRC res;
2644  void *ptr;
2645 
2647  ok(file != INVALID_HANDLE_VALUE, "file creation failed, at %s, error %lu\n", path, GetLastError());
2648 
2650  ok( res != 0, "couldn't find resource\n" );
2653  ok( written == SizeofResource( GetModuleHandleA(NULL), res ), "couldn't write resource\n" );
2654  CloseHandle( file );
2655 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
#define CloseHandle
Definition: compat.h:598
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
#define GENERIC_WRITE
Definition: nt_native.h:90
static PVOID ptr
Definition: dispmode.c:27
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
const char file[]
Definition: icontest.c:11
unsigned long DWORD
Definition: ntddk_ex.h:95
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define GENERIC_READ
Definition: compat.h:135
#define CREATE_ALWAYS
Definition: disk.h:72
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
Definition: name.c:38
GLuint res
Definition: glext.h:9613
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:599
Definition: fci.c:126

Referenced by test_register_typelib(), and test_self_registration().

◆ get_date_str()

static void get_date_str ( LPSTR  date)
static

Definition at line 2614 of file action.c.

2615 {
2616  SYSTEMTIME systime;
2617 
2618  static const char date_fmt[] = "%d%02d%02d";
2619  GetLocalTime(&systime);
2620  sprintf(date, date_fmt, systime.wYear, systime.wMonth, systime.wDay);
2621 }
WORD wMonth
Definition: winbase.h:903
#define sprintf(buf, format,...)
Definition: sprintf.c:55
WORD wYear
Definition: winbase.h:902
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:286
WORD wDay
Definition: winbase.h:905
__u16 date
Definition: mkdosfs.c:366

Referenced by test_publish(), and test_register_product().

◆ get_estimated_size()

static DWORD get_estimated_size ( void  )
static

Definition at line 2624 of file action.c.

2625 {
2626  SYSTEM_INFO si;
2627  HANDLE file;
2628  DWORD size;
2629 
2630  GetSystemInfo(&si);
2631 
2633  size = ((GetFileSize(file, NULL) + si.dwPageSize - 1) / si.dwPageSize + 1);
2634  size = size * si.dwPageSize / 1024;
2635  CloseHandle(file);
2636  return size;
2637 }
#define CloseHandle
Definition: compat.h:598
#define OPEN_EXISTING
Definition: compat.h:634
GLsizeiptr size
Definition: glext.h:5919
const char file[]
Definition: icontest.c:11
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:331
#define GENERIC_READ
Definition: compat.h:135
DWORD dwPageSize
Definition: winbase.h:1158
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
Definition: sysinfo.c:142
#define NULL
Definition: types.h:112
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:599
static const char * msifile
Definition: action.c:66
Definition: fci.c:126

Referenced by test_publish(), and test_register_product().

◆ get_owner_company()

static void get_owner_company ( LPSTR owner,
LPSTR company 
)
static

Definition at line 3411 of file action.c.

3412 {
3413  LONG res;
3414  HKEY hkey;
3416 
3417  *owner = *company = NULL;
3418 
3419  if (is_wow64)
3421 
3423  "Software\\Microsoft\\MS Setup (ACME)\\User Info", &hkey);
3424  if (res == ERROR_SUCCESS)
3425  {
3426  *owner = reg_get_val_str(hkey, "DefName");
3427  *company = reg_get_val_str(hkey, "DefCompany");
3428  RegCloseKey(hkey);
3429  }
3430 
3431  if (!*owner || !*company)
3432  {
3434  "Software\\Microsoft\\Windows NT\\CurrentVersion", 0, access, &hkey);
3435  if (res == ERROR_SUCCESS)
3436  {
3437  *owner = reg_get_val_str(hkey, "RegisteredOwner");
3438  *company = reg_get_val_str(hkey, "RegisteredOrganization");
3439  RegCloseKey(hkey);
3440  }
3441  }
3442 
3443  if (!*owner || !*company)
3444  {
3446  "Software\\Microsoft\\Windows\\CurrentVersion", 0, access, &hkey);
3447  if (res == ERROR_SUCCESS)
3448  {
3449  *owner = reg_get_val_str(hkey, "RegisteredOwner");
3450  *company = reg_get_val_str(hkey, "RegisteredOrganization");
3451  RegCloseKey(hkey);
3452  }
3453  }
3454 }
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3257
#define ERROR_SUCCESS
Definition: deptool.c:10
#define HKEY_CURRENT_USER
Definition: winreg.h:11
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3321
long LONG
Definition: pedump.c:60
static STATEMGRSTATUS *static BOOL is_wow64
Definition: action.c:61
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
static LPSTR reg_get_val_str(HKEY hkey, LPCSTR name)
Definition: action.c:3393
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
ACCESS_MASK REGSAM
Definition: winreg.h:69
#define NULL
Definition: types.h:112
GLuint res
Definition: glext.h:9613
#define RegCloseKey(hKey)
Definition: registry.h:47
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by test_register_user().

◆ get_user_sid()

static char* get_user_sid ( void  )
static

Definition at line 2405 of file action.c.

2406 {
2407  HANDLE token;
2408  DWORD size = 0;
2409  TOKEN_USER *user;
2410  char *usersid = NULL;
2411 
2414 
2415  user = malloc(size);
2417  ConvertSidToStringSidA(user->User.Sid, &usersid);
2418  free(user);
2419 
2420  CloseHandle(token);
2421  return usersid;
2422 }
#define CloseHandle
Definition: compat.h:598
#define free
Definition: debug_ros.c:5
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210
GLsizeiptr size
Definition: glext.h:5919
#define TOKEN_QUERY
Definition: setypes.h:924
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI ConvertSidToStringSidA(PSID Sid, LPSTR *StringSid)
Definition: security.c:3436
#define GetCurrentProcess()
Definition: compat.h:618
#define NULL
Definition: types.h:112
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:413
#define malloc
Definition: debug_ros.c:4
void user(int argc, const char *argv[])
Definition: cmds.c:1350

Referenced by test_process_components(), test_publish_features(), test_publish_product(), test_register_product(), and test_register_user().

◆ init_functionpointers()

static void init_functionpointers ( void  )
static

Definition at line 2378 of file action.c.

2379 {
2380  HMODULE hmsi = GetModuleHandleA("msi.dll");
2381  HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
2382  HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
2383  HMODULE hsrclient = LoadLibraryA("srclient.dll");
2384 
2385 #define GET_PROC(mod, func) \
2386  p ## func = (void*)GetProcAddress(mod, #func); \
2387  if(!p ## func) \
2388  trace("GetProcAddress(%s) failed\n", #func);
2389 
2395 
2396  GET_PROC(hadvapi32, RegDeleteKeyExA)
2398 
2399  GET_PROC(hsrclient, SRRemoveRestorePoint);
2400  GET_PROC(hsrclient, SRSetRestorePointA);
2401 
2402 #undef GET_PROC
2403 }
INSTALLSTATE WINAPI MsiGetComponentPathExA(LPCSTR product, LPCSTR comp, LPCSTR usersid, MSIINSTALLCONTEXT ctx, LPSTR buf, LPDWORD buflen)
Definition: msi.c:2866
LONG WINAPI RegDeleteKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ REGSAM samDesired, _In_ DWORD Reserved)
Definition: reg.c:1252
static HINSTANCE hkernel32
Definition: process.c:66
UINT WINAPI MsiSourceListEnumSourcesA(const char *szProductCodeOrPatch, const char *szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwIndex, char *szSource, DWORD *pcchSource)
Definition: source.c:329
DWORD WINAPI SRRemoveRestorePoint(DWORD dwNumber)
Definition: srclient_main.c:71
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
BOOL WINAPI IsWow64Process(IN HANDLE hProcess, OUT PBOOL Wow64Process)
Definition: proc.c:1975
#define GET_PROC(mod, func)
UINT WINAPI MsiQueryFeatureStateExA(LPCSTR product, LPCSTR usersid, MSIINSTALLCONTEXT ctx, LPCSTR feature, INSTALLSTATE *state)
Definition: msi.c:2993
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
BOOL WINAPI SRSetRestorePointA(PRESTOREPOINTINFOA pRestorePtSpec, PSTATEMGRSTATUS pSMgrStatus)
Definition: sfc.c:54
UINT WINAPI MsiSourceListGetInfoA(LPCSTR szProduct, LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, LPCSTR szProperty, LPSTR szValue, LPDWORD pcchValue)
Definition: source.c:470
UINT WINAPI MsiQueryComponentStateA(LPCSTR szProductCode, LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext, LPCSTR szComponent, INSTALLSTATE *pdwState)
Definition: msi.c:2057

Referenced by START_TEST().

◆ INSTALLSTATE()

static INSTALLSTATE ( WINAPI pMsiGetComponentPathExA)
static

◆ LONG()

static INSTALLSTATE* static LONG ( WINAPI pRegDeleteKeyExA)
static

◆ notify_system_change()

static BOOL notify_system_change ( DWORD  event_type,
STATEMGRSTATUS status 
)
static

Definition at line 2460 of file action.c.

2461 {
2462  RESTOREPOINTINFOA spec;
2463 
2464  spec.dwEventType = event_type;
2466  spec.llSequenceNumber = status->llSequenceNumber;
2467  lstrcpyA(spec.szDescription, "msitest restore point");
2468 
2469  return pSRSetRestorePointA(&spec, status);
2470 }
#define APPLICATION_INSTALL
CHAR szDescription[MAX_DESC]
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
Definition: ps.c:97

Referenced by START_TEST().

◆ reg_get_val_str()

static LPSTR reg_get_val_str ( HKEY  hkey,
LPCSTR  name 
)
static

Definition at line 3393 of file action.c.

3394 {
3395  DWORD len = 0;
3396  LPSTR val;
3397  LONG r;
3398 
3399  r = RegQueryValueExA(hkey, name, NULL, NULL, NULL, &len);
3400  if (r != ERROR_SUCCESS)
3401  return NULL;
3402 
3403  len += sizeof (WCHAR);
3404  val = malloc(len);
3405  if (!val) return NULL;
3406  val[0] = 0;
3407  RegQueryValueExA(hkey, name, NULL, NULL, (LPBYTE)val, &len);
3408  return val;
3409 }
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4027
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
char * LPSTR
Definition: xmlstorage.h:182
unsigned char * LPBYTE
Definition: typedefs.h:53
long LONG
Definition: pedump.c:60
GLuint GLfloat * val
Definition: glext.h:7180
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define NULL
Definition: types.h:112
Definition: name.c:38
#define malloc
Definition: debug_ros.c:4

Referenced by get_owner_company().

◆ remove_restore_point()

static void remove_restore_point ( DWORD  seq_number)
static

Definition at line 2472 of file action.c.

2473 {
2474  DWORD res;
2475 
2476  res = pSRRemoveRestorePoint(seq_number);
2477  if (res != ERROR_SUCCESS)
2478  trace("Failed to remove the restore point : %#lx\n", res);
2479 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define trace
Definition: atltest.h:70
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint res
Definition: glext.h:9613

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( action  )

Definition at line 6533 of file action.c.

6534 {
6535  DWORD len;
6536  char temp_path[MAX_PATH], prev_path[MAX_PATH], log_file[MAX_PATH];
6538  BOOL ret = FALSE;
6539 
6541  subtest("custom");
6542 
6543  if (pIsWow64Process)
6544  pIsWow64Process(GetCurrentProcess(), &is_wow64);
6545 
6546  GetCurrentDirectoryA(MAX_PATH, prev_path);
6549 
6551  len = lstrlenA(CURR_DIR);
6552 
6553  if(len && (CURR_DIR[len - 1] == '\\'))
6554  CURR_DIR[len - 1] = 0;
6555 
6556  ok(get_system_dirs(), "failed to retrieve system dirs\n");
6557  ok(get_user_dirs(), "failed to retrieve user dirs\n");
6558 
6559  /* Create a restore point ourselves so we circumvent the multitude of restore points
6560  * that would have been created by all the installation and removal tests.
6561  *
6562  * This is not needed on version 5.0 where setting MSIFASTINSTALL prevents the
6563  * creation of restore points.
6564  */
6565  if (pSRSetRestorePointA && !pMsiGetComponentPathExA)
6566  {
6567  memset(&status, 0, sizeof(status));
6569  }
6570 
6571  /* Create only one log file and don't append. We have to pass something
6572  * for the log mode for this to work. The logfile needs to have an absolute
6573  * path otherwise we still end up with some extra logfiles as some tests
6574  * change the current directory.
6575  */
6577  lstrcatA(log_file, "\\msitest.log");
6579 
6585  test_publish();
6588  test_move_files();
6591  test_envvar();
6605  test_ini_values();
6612 
6614 
6615  if (pSRSetRestorePointA && !pMsiGetComponentPathExA && ret)
6616  {
6618  if (ret)
6619  remove_restore_point(status.llSequenceNumber);
6620  }
6621 
6622  SetCurrentDirectoryA(prev_path);
6623 }
static void test_delete_services(void)
Definition: action.c:5265
static void test_register_font(void)
Definition: action.c:5460
static void test_remove_existing_products(void)
Definition: action.c:6497
static void test_publish_sourcelist(void)
Definition: action.c:4281
static void test_register_mime_info(void)
Definition: action.c:6232
static void test_find_related_products(void)
Definition: action.c:5886
static void test_publish_features(void)
Definition: action.c:3268
UINT WINAPI MsiEnableLogA(DWORD dwLogMode, const char *szLogFile, DWORD attributes)
Definition: msi.c:1884
UNICODE_STRING log_file
Definition: btrfs.c:88
static void test_install_remove_odbc(void)
Definition: action.c:5567
static void test_validate_product_id(void)
Definition: action.c:5516
static void test_create_remove_shortcut(void)
Definition: action.c:5703
static void test_register_class_info(void)
Definition: action.c:5989
static void test_ini_values(void)
Definition: action.c:5926
static char CURR_DIR[MAX_PATH]
static void test_duplicate_files(void)
Definition: action.c:4769
static void test_process_components(void)
Definition: action.c:3553
#define FALSE
Definition: types.h:117
static void test_register_typelib(void)
Definition: action.c:5651
#define END_NESTED_SYSTEM_CHANGE
unsigned int BOOL
Definition: ntddk_ex.h:94
static void test_self_registration(void)
Definition: action.c:5416
static STATEMGRSTATUS *static BOOL is_wow64
Definition: action.c:61
static void test_install_services(void)
Definition: action.c:5337
static void test_remove_files(void)
Definition: action.c:4488
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
static void test_start_stop_services(void)
Definition: action.c:5148
static void test_write_registry_values(void)
Definition: action.c:4808
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
static void test_register_extension_info(void)
Definition: action.c:6054
#define BEGIN_NESTED_SYSTEM_CHANGE
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
static void test_publish(void)
Definition: action.c:3688
int ret
static void test_remove_duplicate_files(void)
Definition: action.c:5836
BOOL WINAPI SetCurrentDirectoryA(IN LPCSTR lpPathName)
Definition: path.c:2205
GLenum GLsizei len
Definition: glext.h:6722
static void test_publish_product(void)
Definition: action.c:3031
#define GetCurrentProcess()
Definition: compat.h:618
static void test_publish_assemblies(void)
Definition: action.c:6277
static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
Definition: action.c:2460
static void test_envvar(void)
Definition: action.c:4977
static void test_register_user(void)
Definition: action.c:3456
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2053
static void test_publish_components(void)
Definition: action.c:5743
#define ok(value,...)
Definition: atltest.h:57
#define subtest
Definition: test.h:157
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2145
BOOL get_user_dirs(void)
Definition: install.c:2404
static void test_register_progid_info(void)
Definition: action.c:6106
static void test_register_product(void)
Definition: action.c:2657
BOOL get_system_dirs(void)
Definition: install.c:2423
static void test_move_files(void)
Definition: action.c:4622
static void init_functionpointers(void)
Definition: action.c:2378
#define memset(x, y, z)
Definition: compat.h:39
static SERVICE_STATUS status
Definition: service.c:31
static void remove_restore_point(DWORD seq_number)
Definition: action.c:2472
static void test_create_remove_folder(void)
Definition: action.c:5095
char temp_path[MAX_PATH]
Definition: mspatcha.c:123
Definition: ps.c:97

◆ test_create_remove_folder()

static void test_create_remove_folder ( void  )
static

Definition at line 5095 of file action.c.

5096 {
5097  UINT r;
5098 
5099  if (is_process_limited())
5100  {
5101  skip("process is limited\n");
5102  return;
5103  }
5104 
5105  CreateDirectoryA("msitest", NULL);
5106  CreateDirectoryA("msitest\\first", NULL);
5107  CreateDirectoryA("msitest\\second", NULL);
5108  create_file("msitest\\first\\one.txt", 1000);
5109  create_file("msitest\\second\\two.txt", 1000);
5111 
5113 
5116  {
5117  skip("Not enough rights to perform tests\n");
5118  goto error;
5119  }
5120  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5121 
5122  ok(pf_exists("msitest\\first\\one.txt"), "file not installed\n");
5123  ok(pf_exists("msitest\\first"), "directory not created\n");
5124  ok(pf_exists("msitest\\second\\two.txt"), "file not installed\n");
5125  ok(pf_exists("msitest\\second"), "directory not created\n");
5126  ok(pf_exists("msitest\\third"), "directory not created\n");
5127  ok(pf_exists("msitest"), "directory not created\n");
5128 
5129  r = MsiInstallProductA(msifile, "REMOVE=ALL");
5130  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5131 
5132  ok(!pf_exists("msitest\\first\\one.txt"), "file not removed\n");
5133  ok(!pf_exists("msitest\\first"), "directory not removed\n");
5134  ok(!pf_exists("msitest\\second\\two.txt"), "file not removed\n");
5135  ok(!pf_exists("msitest\\second"), "directory not removed\n");
5136  ok(!pf_exists("msitest\\third"), "directory not removed\n");
5137  todo_wine ok(!pf_exists("msitest"), "directory not removed\n");
5138 
5139 error:
5140  DeleteFileA("msitest\\first\\one.txt");
5141  DeleteFileA("msitest\\second\\two.txt");
5142  RemoveDirectoryA("msitest\\first");
5143  RemoveDirectoryA("msitest\\second");
5144  RemoveDirectoryA("msitest");
5146 }
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define ERROR_SUCCESS
Definition: deptool.c:10
#define error(str)
Definition: mkdosfs.c:1605
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:200
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define create_file(name, size)
Definition: asmcache.c:813
#define todo_wine
Definition: custom.c:79
static const msi_table cf_tables[]
Definition: action.c:2081
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2284
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define create_database(name, tables, num_tables)
Definition: utils.h:42
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
static BOOL pf_exists(const char *file)
Definition: custom.c:1406
#define skip(...)
Definition: atltest.h:64
static BOOL is_process_limited(void)
Definition: atl.c:113
static const char * msifile
Definition: action.c:66

Referenced by START_TEST().

◆ test_create_remove_shortcut()

static void test_create_remove_shortcut ( void  )
static

Definition at line 5703 of file action.c.

5704 {
5705  UINT r;
5706 
5707  if (is_process_limited())
5708  {
5709  skip("process is limited\n");
5710  return;
5711  }
5712 
5714  create_file("msitest\\target.txt", 1000);
5716 
5718 
5721  {
5722  skip("Not enough rights to perform tests\n");
5723  goto error;
5724  }
5725  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5726 
5727  ok(pf_exists("msitest\\target.txt"), "file not created\n");
5728  ok(pf_exists("msitest\\shortcut.lnk"), "file not created\n");
5729 
5730  r = MsiInstallProductA(msifile, "REMOVE=ALL");
5731  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5732 
5733  ok(!delete_pf("msitest\\shortcut.lnk", TRUE), "file not removed\n");
5734  ok(!delete_pf("msitest\\target.txt", TRUE), "file not removed\n");
5735  todo_wine ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5736 
5737 error:
5738  DeleteFileA("msitest\\target.txt");
5741 }
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define ERROR_SUCCESS
Definition: deptool.c:10
static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
Definition: automation.c:414
#define error(str)
Definition: mkdosfs.c:1605
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:200
#define TRUE
Definition: types.h:120
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define create_file(name, size)
Definition: asmcache.c:813
#define todo_wine
Definition: custom.c:79
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2284
static void create_test_files(void)
Definition: action.c:2424
#define FALSE
Definition: types.h:117
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define create_database(name, tables, num_tables)
Definition: utils.h:42
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
static const msi_table crs_tables[]
Definition: action.c:2209
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
static void delete_test_files(void)
Definition: action.c:2445
static BOOL pf_exists(const char *file)
Definition: custom.c:1406
#define skip(...)
Definition: atltest.h:64
static BOOL is_process_limited(void)
Definition: atl.c:113
static const char * msifile
Definition: action.c:66

Referenced by START_TEST().

◆ test_delete_services()

static void test_delete_services ( void  )
static

Definition at line 5265 of file action.c.

5266 {
5267  UINT r;
5268  SC_HANDLE manager, service;
5269  DWORD error;
5270 
5271  if (is_process_limited())
5272  {
5273  skip("process is limited\n");
5274  return;
5275  }
5276 
5278  ok(manager != NULL, "can't open service manager %lu\n", GetLastError());
5279  if (!manager) return;
5280 
5281  service = CreateServiceA(manager, "TestService3", "TestService3",
5283  SERVICE_ERROR_NORMAL, "C:\\doesnt_exist.exe", NULL, NULL, NULL, NULL, NULL);
5284  ok(service != NULL, "can't create service %lu\n", GetLastError());
5285  CloseServiceHandle(service);
5286  CloseServiceHandle(manager);
5287  if (!service) return;
5288 
5291 
5293 
5296  {
5297  skip("Not enough rights to perform tests\n");
5298  goto error;
5299  }
5300  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5301 
5303  ok(manager != NULL, "can't open service manager\n");
5304  if (!manager) goto error;
5305 
5306  service = OpenServiceA(manager, "TestService3", GENERIC_ALL);
5307  error = GetLastError();
5308  ok(service == NULL, "TestService3 not deleted\n");
5309  ok(error == ERROR_SERVICE_DOES_NOT_EXIST, "wrong error %lu\n", error);
5310  CloseServiceHandle(manager);
5311 
5312  r = MsiInstallProductA(msifile, "REMOVE=ALL");
5313  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5314 
5315  ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5316  ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5317  ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5318  ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5319  ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5320  ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5321  ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5322  ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5323  ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5324  ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5325  ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5326  ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5327  ok(delete_pf("msitest", FALSE), "Directory not created\n");
5328 
5329 error:
5330  delete_test_service("TestService");
5331  delete_test_service("TestService2");
5332  delete_test_service("TestService3");
5335 }
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define GENERIC_ALL
Definition: nt_native.h:92
#define SERVICE_ERROR_NORMAL
Definition: cmtypes.h:982
#define ERROR_SUCCESS
Definition: deptool.c:10
static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
Definition: automation.c:414
#define error(str)
Definition: mkdosfs.c:1605
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:200
#define TRUE
Definition: types.h:120
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2284
#define SERVICE_ALL_ACCESS
Definition: winsvc.h:62
static void create_test_files(void)
Definition: action.c:2424
SC_HANDLE WINAPI CreateServiceA(SC_HANDLE hSCManager, LPCSTR lpServiceName, LPCSTR lpDisplayName, DWORD dwDesiredAccess, DWORD dwServiceType, DWORD dwStartType, DWORD dwErrorControl, LPCSTR lpBinaryPathName, LPCSTR lpLoadOrderGroup, LPDWORD lpdwTagId, LPCSTR lpDependencies, LPCSTR lpServiceStartName, LPCSTR lpPassword)
Definition: scm.c:680
SC_HANDLE WINAPI OpenSCManagerA(LPCSTR lpMachineName, LPCSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:1972
#define FALSE
Definition: types.h:117
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:580
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define SERVICE_WIN32_OWN_PROCESS
Definition: cmtypes.h:962
unsigned long DWORD
Definition: ntddk_ex.h:95
#define create_database(name, tables, num_tables)
Definition: utils.h:42
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
static void delete_test_files(void)
Definition: action.c:2445
#define SC_MANAGER_ALL_ACCESS
Definition: winsvc.h:13
#define ERROR_SERVICE_DOES_NOT_EXIST
Definition: winerror.h:611
SC_HANDLE WINAPI OpenServiceA(SC_HANDLE hSCManager, LPCSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:2060
#define skip(...)
Definition: atltest.h:64
static const msi_table sds_tables[]
Definition: action.c:2109
static BOOL is_process_limited(void)
Definition: atl.c:113
#define SERVICE_DEMAND_START
Definition: cmtypes.h:978
static const char * msifile
Definition: action.c:66
static void delete_test_service(const char *name)
Definition: action.c:5246

Referenced by START_TEST().

◆ test_duplicate_files()

static void test_duplicate_files ( void  )
static

Definition at line 4769 of file action.c.

4770 {
4771  UINT r;
4772 
4773  if (is_process_limited())
4774  {
4775  skip("process is limited\n");
4776  return;
4777  }
4778 
4779  CreateDirectoryA("msitest", NULL);
4780  create_file("msitest\\maximus", 500);
4782 
4784 
4785  /* fails if the destination folder is not a valid property */
4786 
4789  {
4790  skip("Not enough rights to perform tests\n");
4791  goto error;
4792  }
4793  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4794  ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4795  ok(delete_pf("msitest\\augustus", TRUE), "File not duplicated\n");
4796  ok(delete_pf("msitest\\this\\doesnot\\exist\\maximus", TRUE), "File not duplicated\n");
4797  ok(delete_pf("msitest\\this\\doesnot\\exist", FALSE), "Directory not created\n");
4798  ok(delete_pf("msitest\\this\\doesnot", FALSE), "Directory not created\n");
4799  ok(delete_pf("msitest\\this", FALSE), "Directory not created\n");
4800  ok(delete_pf("msitest", FALSE), "Directory not created\n");
4801 
4802 error:
4803  DeleteFileA("msitest\\maximus");
4804  RemoveDirectoryA("msitest");
4806 }
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define ERROR_SUCCESS
Definition: deptool.c:10
static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
Definition: automation.c:414
#define error(str)
Definition: mkdosfs.c:1605
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:200
#define TRUE
Definition: types.h:120
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define create_file(name, size)
Definition: asmcache.c:813
static const msi_table df_tables[]
Definition: action.c:2054
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2284
#define FALSE
Definition: types.h:117
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define create_database(name, tables, num_tables)
Definition: utils.h:42
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define skip(...)
Definition: atltest.h:64
static BOOL is_process_limited(void)
Definition: atl.c:113
static const char * msifile
Definition: action.c:66

Referenced by START_TEST().

◆ test_envvar()

static void test_envvar ( void  )
static

Definition at line 4977 of file action.c.

4978 {
4979  char buffer[16];
4980  UINT r, i;
4981  HKEY env, env2;
4982  LONG res;
4983 
4984  if (is_process_limited())
4985  {
4986  skip("process is limited\n");
4987  return;
4988  }
4989 
4991 
4992  res = RegCreateKeyExA(HKEY_CURRENT_USER, "Environment", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &env, NULL);
4993  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4994 
4995  res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "System\\CurrentControlSet\\Control\\Session Manager\\Environment",
4996  0, NULL, 0, KEY_ALL_ACCESS, NULL, &env2, NULL);
4997  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
4998 
4999  res = RegSetValueExA(env, "MSITESTVAR1", 0, REG_SZ, (const BYTE *)"0", 2);
5000  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
5001 
5002  res = RegSetValueExA(env, "MSITESTVAR2", 0, REG_SZ, (const BYTE *)"0", 2);
5003  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
5004 
5005  res = RegSetValueExA(env, "MSITESTVAR21", 0, REG_SZ, (const BYTE *)"1", 2);
5006  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
5007 
5009 
5012  {
5013  skip("Not enough rights to perform tests\n");
5014  goto error;
5015  }
5016  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5017 
5018  CHECK_REG_STR(env, "MSITESTVAR1", "1");
5019  CHECK_REG_STR(env, "MSITESTVAR2", "1");
5020  CHECK_REG_STR(env, "MSITESTVAR3", "1");
5021  CHECK_REG_STR(env, "MSITESTVAR4", "1");
5022 
5023  res = RegDeleteValueA(env, "MSITESTVAR5");
5024  ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res);
5025 
5026  res = RegDeleteValueA(env, "MSITESTVAR6");
5027  ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res);
5028 
5029  res = RegDeleteValueA(env, "MSITESTVAR7");
5030  ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res);
5031 
5032  res = RegDeleteValueA(env, "MSITESTVAR8");
5033  ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res);
5034 
5035  res = RegDeleteValueA(env, "MSITESTVAR9");
5036  ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res);
5037 
5038  res = RegDeleteValueA(env, "MSITESTVAR10");
5039  ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res);
5040 
5041  CHECK_REG_STR(env, "MSITESTVAR11", "1;2");
5042  CHECK_REG_STR(env, "MSITESTVAR12", "1");
5043  CHECK_REG_STR(env, "MSITESTVAR13", "1;2");
5044  CHECK_REG_STR(env, "MSITESTVAR14", ";1;");
5045  CHECK_REG_STR(env, "MSITESTVAR15", ";;1;;");
5046  CHECK_REG_STR(env, "MSITESTVAR16", " 1 ");
5047  CHECK_REG_STR(env, "MSITESTVAR17", ";;2;;1");
5048  CHECK_REG_STR(env, "MSITESTVAR18", "1;;2;;");
5049  CHECK_REG_STR(env, "MSITESTVAR19", "1");
5050  CHECK_REG_STR(env, "MSITESTVAR20", "1");
5051  CHECK_REG_STR(env, "MSITESTVAR21", "1");
5052  CHECK_REG_STR(env, "MSITESTVAR24", "TestService");
5053  CHECK_REG_STR(env2, "MSITESTVAR100", "1");
5054 
5055  res = RegSetValueExA(env, "MSITESTVAR22", 0, REG_SZ, (const BYTE *)"1", 2);
5056  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
5057 
5058  res = RegSetValueExA(env, "MSITESTVAR23", 0, REG_SZ, (const BYTE *)"1", 2);
5059  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
5060 
5061  res = RegDeleteValueA(env, "MSITESTVAR25");
5062  ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res);
5063 
5064  r = MsiInstallProductA(msifile, "REMOVE=ALL");
5065  ok(!r, "got %u\n", r);
5066 
5067  CHECK_DEL_REG_STR(env, "MSITESTVAR13", "1;2");
5068  CHECK_DEL_REG_STR(env, "MSITESTVAR14", ";1;");
5069  CHECK_DEL_REG_STR(env, "MSITESTVAR15", ";;1;;");
5070  CHECK_DEL_REG_STR(env, "MSITESTVAR16", " 1 ");
5071  CHECK_DEL_REG_STR_TODO(env, "MSITESTVAR17", "1");
5072  CHECK_DEL_REG_STR_TODO(env, "MSITESTVAR18", "1");
5073  CHECK_DEL_REG_STR(env, "MSITESTVAR23", "1");
5074 
5075  for (i = 1; i <= 23; i++)
5076  {
5077  sprintf(buffer, "MSITESTVAR%i", i);
5079  ok(res == ERROR_FILE_NOT_FOUND, "[%d] got %ld\n", i, res);
5080  }
5081 
5082  res = RegDeleteValueA(env2, "MSITESTVAR100");
5083  ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res);
5084 
5085 error:
5086  RegDeleteValueA(env, "MSITESTVAR1");
5087  RegDeleteValueA(env, "MSITESTVAR2");
5088  RegDeleteValueA(env, "MSITESTVAR21");
5089  RegCloseKey(env);
5090  RegCloseKey(env2);
5091 
5093 }
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define ERROR_SUCCESS
Definition: deptool.c:10
#define error(str)
Definition: mkdosfs.c:1605
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:200
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define HKEY_CURRENT_USER
Definition: winreg.h:11
GLuint buffer
Definition: glext.h:5915
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2284
#define sprintf(buf, format,...)
Definition: sprintf.c:55
long LONG
Definition: pedump.c:60
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static const msi_table env_tables[]
Definition: action.c:1987
#define create_database(name, tables, num_tables)
Definition: utils.h:42
unsigned char BYTE
Definition: xxhash.c:193
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ARRAY_SIZE(a)
Definition: main.h:24
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define ok(value,...)
Definition: atltest.h:57
LONG WINAPI RegDeleteValueA(HKEY hKey, LPCSTR lpValueName)
Definition: reg.c:2319
#define CHECK_DEL_REG_STR(prodkey, name, expected)
Definition: action.c:2566
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
static LPCWSTR LPCWSTR LPCWSTR env
Definition: db.cpp:170
#define skip(...)
Definition: atltest.h:64
GLuint res
Definition: glext.h:9613
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4816
LONG WINAPI RegCreateKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD Reserved, _In_ LPSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_ LPDWORD lpdwDisposition)
Definition: reg.c:1029
static BOOL is_process_limited(void)
Definition: atl.c:113
#define CHECK_REG_STR(prodkey, name, expected)
Definition: action.c:2563
#define CHECK_DEL_REG_STR_TODO(prodkey, name, expected)
Definition: action.c:2572
#define RegCloseKey(hKey)
Definition: registry.h:47
static const char * msifile
Definition: action.c:66
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22

Referenced by START_TEST().

◆ test_find_related_products()

static void test_find_related_products ( void  )
static

Definition at line 5886 of file action.c.

5887 {
5888  UINT r;
5889 
5890  if (is_process_limited())
5891  {
5892  skip("process is limited\n");
5893  return;
5894  }
5895 
5897  create_file("msitest\\product.txt", 1000);
5899 
5901 
5904  {
5905  skip("Not enough rights to perform tests\n");
5906  goto error;
5907  }
5908  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5909 
5910  /* install again, so it finds the upgrade code */
5912  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5913 
5914  r = MsiInstallProductA(msifile, "REMOVE=ALL");
5915  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5916 
5917  ok(!delete_pf("msitest\\product.txt", TRUE), "file not removed\n");
5918  ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5919 
5920 error:
5921  DeleteFileA("msitest\\product.txt");
5924 }
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define ERROR_SUCCESS
Definition: deptool.c:10
static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
Definition: automation.c:414
#define error(str)
Definition: mkdosfs.c:1605
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:200
#define TRUE
Definition: types.h:120
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define create_file(name, size)
Definition: asmcache.c:813
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2284
static void create_test_files(void)
Definition: action.c:2424
#define FALSE
Definition: types.h:117
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define create_database(name, tables, num_tables)
Definition: utils.h:42
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
static void delete_test_files(void)
Definition: action.c:2445
#define skip(...)
Definition: atltest.h:64
static BOOL is_process_limited(void)
Definition: atl.c:113
static const msi_table frp_tables[]
Definition: action.c:2251
static const char * msifile
Definition: action.c:66

Referenced by START_TEST().

◆ test_ini_values()

static void test_ini_values ( void  )
static

Definition at line 5926 of file action.c.

5927 {
5928  UINT r;
5929  DWORD len;
5930  char inifile[MAX_PATH], buf[0x10];
5931  HANDLE file;
5932  BOOL ret;
5933 
5934  if (is_process_limited())
5935  {
5936  skip("process is limited\n");
5937  return;
5938  }
5939 
5941  create_file("msitest\\inifile.txt", 1000);
5943 
5944  lstrcpyA(inifile, PROG_FILES_DIR);
5945  lstrcatA(inifile, "\\msitest");
5946  ret = CreateDirectoryA(inifile, NULL);
5947  if (!ret && GetLastError() == ERROR_ACCESS_DENIED)
5948  {
5949  skip("Not enough rights to perform tests\n");
5950  goto error;
5951  }
5952  lstrcatA(inifile, "\\test.ini");
5954  CloseHandle(file);
5955 
5956  ret = WritePrivateProfileStringA("sectionA", "keyA", "valueA", inifile);
5957  ok(ret, "failed to write profile string %lu\n", GetLastError());
5958 
5960 
5962  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5963 
5964  len = GetPrivateProfileStringA("section1", "key1", NULL, buf, sizeof(buf), inifile);
5965  ok(len == 6, "got %lu expected 6\n", len);
5966 
5967  len = GetPrivateProfileStringA("sectionA", "keyA", NULL, buf, sizeof(buf), inifile);
5968  ok(!len, "got %lu expected 0\n", len);
5969 
5970  r = MsiInstallProductA(msifile, "REMOVE=ALL");
5971  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5972 
5973  len = GetPrivateProfileStringA("section1", "key1", NULL, buf, sizeof(buf), inifile);
5974  ok(!len, "got %lu expected 0\n", len);
5975 
5976  len = GetPrivateProfileStringA("sectionA", "keyA", NULL, buf, sizeof(buf), inifile);
5977  ok(!len, "got %lu expected 0\n", len);
5978 
5979  todo_wine ok(!delete_pf("msitest\\test.ini", TRUE), "file removed\n");
5980  ok(!delete_pf("msitest\\inifile.txt", TRUE), "file not removed\n");
5981  ok(delete_pf("msitest", FALSE), "directory removed\n");
5982 
5983 error:
5984  DeleteFileA("msitest\\inifile.txt");
5987 }
#define CloseHandle
Definition: compat.h:598
#define ERROR_SUCCESS
Definition: deptool.c:10
static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
Definition: automation.c:414
#define error(str)
Definition: mkdosfs.c:1605
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:200
#define TRUE
Definition: types.h:120
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static char PROG_FILES_DIR[MAX_PATH]
Definition: automation.c:362
#define create_file(name, size)
Definition: asmcache.c:813
#define todo_wine
Definition: custom.c:79
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2284
static void create_test_files(void)
Definition: action.c:2424
INT WINAPI GetPrivateProfileStringA(LPCSTR section, LPCSTR entry, LPCSTR def_val, LPSTR buffer, UINT len, LPCSTR filename)
Definition: profile.c:1204
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define FALSE
Definition: types.h:117
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GENERIC_WRITE
Definition: nt_native.h:90
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
#define MAX_PATH
Definition: compat.h:34
const char file[]
Definition: icontest.c:11
unsigned long DWORD
Definition: ntddk_ex.h:95
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define GENERIC_READ
Definition: compat.h:135
#define create_database(name, tables, num_tables)
Definition: utils.h:42
#define CREATE_ALWAYS
Definition: disk.h:72
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
static void delete_test_files(void)
Definition: action.c:2445
#define skip(...)
Definition: atltest.h:64
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:599
static BOOL is_process_limited(void)
Definition: atl.c:113
BOOL WINAPI DECLSPEC_HOTPATCH WritePrivateProfileStringA(LPCSTR section, LPCSTR entry, LPCSTR string, LPCSTR filename)
Definition: profile.c:1484
static const char * msifile
Definition: action.c:66
Definition: fci.c:126
static const msi_table ini_tables[]
Definition: action.c:2265

Referenced by START_TEST().

◆ test_install_remove_odbc()

static void test_install_remove_odbc ( void  )
static

Definition at line 5567 of file action.c.

5568 {
5569  int gotdriver = 0, gotdriver2 = 0;
5570  char buffer[1000], *p;
5571  WORD len;
5572  UINT r;
5573 
5574  if (is_process_limited())
5575  {
5576  skip("process is limited\n");
5577  return;
5578  }
5579 
5581  create_file("msitest\\ODBCdriver.dll", 1000);
5582  create_file("msitest\\ODBCdriver2.dll", 1000);
5583  create_file("msitest\\ODBCtranslator.dll", 1000);
5584  create_file("msitest\\ODBCtranslator2.dll", 1000);
5585  create_file("msitest\\ODBCsetup.dll", 1000);
5587 
5589 
5592  {
5593  skip("Not enough rights to perform tests\n");
5594  goto error;
5595  }
5596  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5597 
5598  ok(pf_exists("msitest\\ODBCdriver.dll"), "file not created\n");
5599  ok(pf_exists("msitest\\ODBCdriver2.dll"), "file not created\n");
5600  ok(pf_exists("msitest\\ODBCtranslator.dll"), "file not created\n");
5601  ok(pf_exists("msitest\\ODBCtranslator2.dll"), "file not created\n");
5602  ok(pf_exists("msitest\\ODBCsetup.dll"), "file not created\n");
5603 
5604  r = SQLGetInstalledDrivers(buffer, sizeof(buffer), &len);
5605  ok(len < sizeof(buffer), "buffer too small\n");
5606  ok(r, "SQLGetInstalledDrivers failed\n");
5607  for (p = buffer; *p; p += strlen(p) + 1)
5608  {
5609  if (!strcmp(p, "ODBC test driver"))
5610  gotdriver = 1;
5611  if (!strcmp(p, "ODBC test driver2"))
5612  gotdriver2 = 1;
5613  }
5614  ok(gotdriver, "driver not installed\n");
5615  ok(gotdriver2, "driver 2 not installed\n");
5616 
5617  r = MsiInstallProductA(msifile, "REMOVE=ALL");
5618  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5619 
5620  ok(!delete_pf("msitest\\ODBCdriver.dll", TRUE), "file not removed\n");
5621  ok(!delete_pf("msitest\\ODBCdriver2.dll", TRUE), "file not removed\n");
5622  ok(!delete_pf("msitest\\ODBCtranslator.dll", TRUE), "file not removed\n");
5623  ok(!delete_pf("msitest\\ODBCtranslator2.dll", TRUE), "file not removed\n");
5624  ok(!delete_pf("msitest\\ODBCsetup.dll", TRUE), "file not removed\n");
5625  ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5626 
5627  gotdriver = gotdriver2 = 0;
5628  r = SQLGetInstalledDrivers(buffer, sizeof(buffer), &len);
5629  ok(len < sizeof(buffer), "buffer too small\n");
5630  ok(r, "SQLGetInstalledDrivers failed\n");
5631  for (p = buffer; *p; p += strlen(p) + 1)
5632  {
5633  if (!strcmp(p, "ODBC test driver"))
5634  gotdriver = 1;
5635  if (!strcmp(p, "ODBC test driver2"))
5636  gotdriver2 = 1;
5637  }
5638  ok(!gotdriver, "driver not installed\n");
5639  ok(!gotdriver2, "driver 2 not installed\n");
5640 
5641 error:
5642  DeleteFileA("msitest\\ODBCdriver.dll");
5643  DeleteFileA("msitest\\ODBCdriver2.dll");
5644  DeleteFileA("msitest\\ODBCtranslator.dll");
5645  DeleteFileA("msitest\\ODBCtranslator2.dll");
5646  DeleteFileA("msitest\\ODBCsetup.dll");
5649 }
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define ERROR_SUCCESS
Definition: deptool.c:10
static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
Definition: automation.c:414
#define error(str)
Definition: mkdosfs.c:1605
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:200
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define TRUE
Definition: types.h:120
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define create_file(name, size)
Definition: asmcache.c:813
GLuint buffer
Definition: glext.h:5915
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2284
static void create_test_files(void)
Definition: action.c:2424
#define FALSE
Definition: types.h:117
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
unsigned short WORD
Definition: ntddk_ex.h:93
GLenum GLsizei len
Definition: glext.h:6722
#define create_database(name, tables, num_tables)
Definition: utils.h:42
BOOL WINAPI SQLGetInstalledDrivers(char *buf, WORD size, WORD *sizeout)
Definition: odbccp32.c:561
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
static void delete_test_files(void)
Definition: action.c:2445
static BOOL pf_exists(const char *file)
Definition: custom.c:1406
static const msi_table odbc_tables[]
Definition: action.c:2179
#define skip(...)
Definition: atltest.h:64
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
static BOOL is_process_limited(void)
Definition: atl.c:113
GLfloat GLfloat p
Definition: glext.h:8902
static const char * msifile
Definition: action.c:66

Referenced by START_TEST().

◆ test_install_services()

static void test_install_services ( void  )
static

Definition at line 5337 of file action.c.

5338 {
5339  UINT r;
5340  SC_HANDLE manager, service;
5341  LONG res;
5342  HKEY hKey;
5343  DWORD err_control, err_controlsize, err_controltype;
5344 
5345  if (is_process_limited())
5346  {
5347  skip("process is limited\n");
5348  return;
5349  }
5350 
5353 
5355 
5358  {
5359  skip("Not enough rights to perform tests\n");
5360  goto error;
5361  }
5362  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5363 
5365  ok(manager != NULL, "can't open service manager\n");
5366  if (!manager) goto error;
5367 
5368  service = OpenServiceA(manager, "TestService", GENERIC_ALL);
5369  ok(service != NULL, "TestService not installed\n");
5370  CloseServiceHandle(service);
5371 
5372  service = OpenServiceA(manager, "TestService4", GENERIC_ALL);
5373  ok(service == NULL, "TestService4 installed\n");
5374 
5375  res = RegOpenKeyA(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\TestService", &hKey);
5376  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
5377 
5378  if (res == ERROR_SUCCESS)
5379  {
5380  err_control = 0xBEEF;
5381  err_controltype = REG_DWORD;
5382  err_controlsize = sizeof(err_control);
5383  res = RegQueryValueExA(hKey, "ErrorControl", NULL, &err_controltype, (LPBYTE)&err_control, &err_controlsize);
5384  ok(err_control == 0, "TestService.ErrorControl wrong, expected 0, got %lu\n", err_control);
5385  RegCloseKey(hKey);
5386  }
5387 
5388  r = MsiInstallProductA(msifile, "REMOVE=ALL");
5389  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5390 
5391  service = OpenServiceA(manager, "TestService", GENERIC_ALL);
5392  ok(service != NULL, "TestService deleted\n");
5393  CloseServiceHandle(service);
5394  CloseServiceHandle(manager);
5395 
5396  ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5397  ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5398  ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5399  ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5400  ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5401  ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5402  ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5403  ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5404  ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5405  ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5406  ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5407  ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5408  ok(delete_pf("msitest", FALSE), "Directory not created\n");
5409 
5410 error:
5411  delete_test_service("TestService");
5414 }
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3257
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4027
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define GENERIC_ALL
Definition: nt_native.h:92
static const msi_table sis_tables[]
Definition: action.c:2124
#define ERROR_SUCCESS
Definition: deptool.c:10
static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
Definition: automation.c:414
#define error(str)
Definition: mkdosfs.c:1605
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:200
#define TRUE
Definition: types.h:120
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2284
static void create_test_files(void)
Definition: action.c:2424
unsigned char * LPBYTE
Definition: typedefs.h:53
SC_HANDLE WINAPI OpenSCManagerA(LPCSTR lpMachineName, LPCSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:1972
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:580
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
unsigned long DWORD
Definition: ntddk_ex.h:95
#define create_database(name, tables, num_tables)
Definition: utils.h:42
FxAutoRegKey hKey
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
static void delete_test_files(void)
Definition: action.c:2445
#define SC_MANAGER_ALL_ACCESS
Definition: winsvc.h:13
SC_HANDLE WINAPI OpenServiceA(SC_HANDLE hSCManager, LPCSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:2060
#define skip(...)
Definition: atltest.h:64
GLuint res
Definition: glext.h:9613
static BOOL is_process_limited(void)
Definition: atl.c:113
#define REG_DWORD
Definition: sdbapi.c:596
#define RegCloseKey(hKey)
Definition: registry.h:47
static const char * msifile
Definition: action.c:66
static void delete_test_service(const char *name)
Definition: action.c:5246
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by START_TEST().

◆ test_move_files()

static void test_move_files ( void  )
static

Definition at line 4622 of file action.c.

4623 {
4624  UINT r;
4625  char props[4 * MAX_PATH + 74];
4626 
4627  if (is_process_limited())
4628  {
4629  skip("process is limited\n");
4630  return;
4631  }
4632 
4633  CreateDirectoryA("msitest", NULL);
4634  create_file("msitest\\augustus", 100);
4635  create_file("cameroon", 100);
4636  create_file("djibouti", 100);
4637  create_file("egypt", 100);
4638  create_file("finland", 100);
4639  create_file("gambai", 100);
4640  create_file("honduras", 100);
4641  create_file("msitest\\india", 100);
4642  create_file("japan", 100);
4643  create_file("kenya", 100);
4644  CreateDirectoryA("latvia", NULL);
4645  create_file("nauru", 100);
4646  create_file("peru", 100);
4647  create_file("apple", 100);
4648  create_file("application", 100);
4649  create_file("ape", 100);
4650  create_file("foo", 100);
4651  create_file("fao", 100);
4652  create_file("fbod", 100);
4653  create_file("budding", 100);
4654  create_file("buddy", 100);
4655  create_file("bud", 100);
4656  create_file("bar", 100);
4657  create_file("bur", 100);
4658  create_file("bird", 100);
4659 
4661 
4663 
4664  /* if the source or dest property is not a full path,
4665  * windows tries to access it as a network resource
4666  */
4667 
4668  sprintf(props, "SOURCEFULL=\"%s\\\" DESTFULL=\"%s\\msitest\" "
4669  "FILEPATHBAD=\"%s\\japan\" FILEPATHGOOD=\"%s\\kenya\"",
4671 
4674  {
4675  skip("Not enough rights to perform tests\n");
4676  goto error;
4677  }
4678  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4679  ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4680  ok(!delete_pf("msitest\\dest", TRUE), "File copied\n");
4681  ok(delete_pf("msitest\\canada", TRUE), "File not copied\n");
4682  ok(delete_pf("msitest\\dominica", TRUE), "File not moved\n");
4683  ok(!delete_pf("msitest\\elsalvador", TRUE), "File moved\n");
4684  ok(!delete_pf("msitest\\france", TRUE), "File moved\n");
4685  ok(!delete_pf("msitest\\georgia", TRUE), "File moved\n");
4686  ok(delete_pf("msitest\\hungary", TRUE), "File not moved\n");
4687  ok(!delete_pf("msitest\\indonesia", TRUE), "File moved\n");
4688  ok(!delete_pf("msitest\\jordan", TRUE), "File moved\n");
4689  ok(delete_pf("msitest\\kiribati", TRUE), "File not moved\n");
4690  ok(!delete_pf("msitest\\lebanon", TRUE), "File moved\n");
4691  ok(!delete_pf("msitest\\lebanon", FALSE), "Directory moved\n");
4692  ok(delete_pf("msitest\\poland", TRUE), "File not moved\n");
4693  /* either apple or application will be moved depending on directory order */
4694  if (!delete_pf("msitest\\apple", TRUE))
4695  ok(delete_pf("msitest\\application", TRUE), "File not moved\n");
4696  else
4697  ok(!delete_pf("msitest\\application", TRUE), "File should not exist\n");
4698  ok(delete_pf("msitest\\wildcard", TRUE), "File not moved\n");
4699  ok(!delete_pf("msitest\\ape", TRUE), "File moved\n");
4700  /* either fao or foo will be moved depending on directory order */
4701  if (delete_pf("msitest\\foo", TRUE))
4702  ok(!delete_pf("msitest\\fao", TRUE), "File should not exist\n");
4703  else
4704  ok(delete_pf("msitest\\fao", TRUE), "File not moved\n");
4705  ok(delete_pf("msitest\\single", TRUE), "File not moved\n");
4706  ok(!delete_pf("msitest\\fbod", TRUE), "File moved\n");
4707  ok(delete_pf("msitest\\budding", TRUE), "File not moved\n");
4708  ok(delete_pf("msitest\\buddy", TRUE), "File not moved\n");
4709  ok(!delete_pf("msitest\\bud", TRUE), "File moved\n");
4710  ok(delete_pf("msitest\\bar", TRUE), "File not moved\n");
4711  ok(delete_pf("msitest\\bur", TRUE), "File not moved\n");
4712  ok(!delete_pf("msitest\\bird", TRUE), "File moved\n");
4713  ok(delete_pf("msitest", FALSE), "Directory not created\n");
4714  ok(DeleteFileA("cameroon"), "File moved\n");
4715  ok(!DeleteFileA("djibouti"), "File not moved\n");
4716  ok(DeleteFileA("egypt"), "File moved\n");
4717  ok(DeleteFileA("finland"), "File moved\n");
4718  ok(DeleteFileA("gambai"), "File moved\n");
4719  ok(!DeleteFileA("honduras"), "File not moved\n");
4720  ok(DeleteFileA("msitest\\india"), "File moved\n");
4721  ok(DeleteFileA("japan"), "File moved\n");
4722  ok(!DeleteFileA("kenya"), "File not moved\n");
4723  ok(RemoveDirectoryA("latvia"), "Directory moved\n");
4724  ok(!DeleteFileA("nauru"), "File not moved\n");
4725  ok(!DeleteFileA("peru"), "File not moved\n");
4726  ok(!DeleteFileA("apple"), "File not moved\n");
4727  ok(!DeleteFileA("application"), "File not moved\n");
4728  ok(DeleteFileA("ape"), "File moved\n");
4729  ok(!DeleteFileA("foo"), "File not moved\n");
4730  ok(!DeleteFileA("fao"), "File not moved\n");
4731  ok(DeleteFileA("fbod"), "File moved\n");
4732  ok(!DeleteFileA("budding"), "File not moved\n");
4733  ok(!DeleteFileA("buddy"), "File not moved\n");
4734  ok(DeleteFileA("bud"), "File moved\n");
4735  ok(!DeleteFileA("bar"), "File not moved\n");
4736  ok(!DeleteFileA("bur"), "File not moved\n");
4737  ok(DeleteFileA("bird"), "File moved\n");
4738 
4739 error:
4740  DeleteFileA("cameroon");
4741  DeleteFileA("djibouti");
4742  DeleteFileA("egypt");
4743  DeleteFileA("finland");
4744  DeleteFileA("gambai");
4745  DeleteFileA("honduras");
4746  DeleteFileA("japan");
4747  DeleteFileA("kenya");
4748  DeleteFileA("nauru");
4749  DeleteFileA("peru");
4750  DeleteFileA("apple");
4751  DeleteFileA("application");
4752  DeleteFileA("ape");
4753  DeleteFileA("foo");
4754  DeleteFileA("fao");
4755  DeleteFileA("fbod");
4756  DeleteFileA("budding");
4757  DeleteFileA("buddy");
4758  DeleteFileA("bud");
4759  DeleteFileA("bar");
4760  DeleteFileA("bur");
4761  DeleteFileA("bird");
4762  DeleteFileA("msitest\\india");
4763  DeleteFileA("msitest\\augustus");
4764  RemoveDirectoryA("latvia");
4765  RemoveDirectoryA("msitest");
4767 }
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define ERROR_SUCCESS
Definition: deptool.c:10
static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
Definition: automation.c:414
#define error(str)
Definition: mkdosfs.c:1605
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:200
#define TRUE
Definition: types.h:120
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static char PROG_FILES_DIR[MAX_PATH]
Definition: automation.c:362
#define create_file(name, size)
Definition: asmcache.c:813
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2284
static const msi_table mov_tables[]
Definition: action.c:2040
static char CURR_DIR[MAX_PATH]
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define FALSE
Definition: types.h:117
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define MAX_PATH
Definition: compat.h:34
#define create_database(name, tables, num_tables)
Definition: utils.h:42
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define skip(...)
Definition: atltest.h:64
static const WCHAR props[]
Definition: wbemdisp.c:288
static BOOL is_process_limited(void)
Definition: atl.c:113
static const char * msifile
Definition: action.c:66

Referenced by START_TEST().

◆ test_process_components()

static void test_process_components ( void  )
static

Definition at line 3553 of file action.c.

3554 {
3555  static const char keyfmt[] =
3556  "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Components\\%s";
3557  static const char compkey[] =
3558  "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Components";
3559  UINT r;
3560  LONG res;
3561  DWORD size;
3562  HKEY comp, hkey;
3563  LPSTR usersid;
3564  CHAR val[MAX_PATH];
3565  CHAR keypath[MAX_PATH];
3566  CHAR program_files_maximus[MAX_PATH];
3568 
3569  if (is_process_limited())
3570  {
3571  skip("process is limited\n");
3572  return;
3573  }
3574 
3575  if (!(usersid = get_user_sid()))
3576  return;
3577 
3578  CreateDirectoryA("msitest", NULL);
3579  create_file("msitest\\maximus", 500);
3580 
3582 
3583  if (is_wow64)
3585 
3587 
3588  /* ProcessComponents, per-user */
3589  r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
3591  {
3592  skip("Not enough rights to perform tests\n");
3593  goto error;
3594  }
3595  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3596  ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3597  ok(delete_pf("msitest", FALSE), "Directory not created\n");
3598 
3599  sprintf(keypath, keyfmt, usersid, "CBABC2FDCCB35E749A8944D8C1C098B5");
3600  res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &comp);
3601  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
3602 
3603  size = MAX_PATH;
3604  res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3605  NULL, NULL, (LPBYTE)val, &size);
3606  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
3607 
3608  lstrcpyA(program_files_maximus,PROG_FILES_DIR);
3609  lstrcatA(program_files_maximus,"\\msitest\\maximus");
3610 
3611  ok(!lstrcmpiA(val, program_files_maximus),
3612  "Expected \"%s\", got \"%s\"\n", program_files_maximus, val);
3613 
3614  res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, compkey, 0, access, &hkey);
3615  ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res);
3616 
3617  RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3618  delete_key(comp, "", access);
3619  RegCloseKey(comp);
3620 
3621  sprintf(keypath, keyfmt, usersid, "241C3DA58FECD0945B9687D408766058");
3622  res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &comp);
3623  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
3624 
3625  size = MAX_PATH;
3626  res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3627  NULL, NULL, (LPBYTE)val, &size);
3628  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
3629  ok(!lstrcmpA(val, "01\\msitest\\augustus"),
3630  "Expected \"01\\msitest\\augustus\", got \"%s\"\n", val);
3631 
3632  res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, compkey, 0, access, &hkey);
3633  ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res);
3634 
3635  RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3636  delete_key(comp, "", access);
3637  RegCloseKey(comp);
3638 
3639  /* ProcessComponents, machine */
3640  r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1 ALLUSERS=1");
3641  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3642  ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3643  ok(delete_pf("msitest", FALSE), "Directory not created\n");
3644 
3645  sprintf(keypath, keyfmt, "S-1-5-18", "CBABC2FDCCB35E749A8944D8C1C098B5");
3646  res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &comp);
3647  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
3648 
3649  size = MAX_PATH;
3650  res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3651  NULL, NULL, (LPBYTE)val, &size);
3652  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
3653  ok(!lstrcmpiA(val, program_files_maximus),
3654  "Expected \"%s\", got \"%s\"\n", program_files_maximus, val);
3655 
3656  res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, compkey, 0, access, &hkey);
3657  ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res);
3658 
3659  RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3660  delete_key(comp, "", access);
3661  RegCloseKey(comp);
3662 
3663  sprintf(keypath, keyfmt, "S-1-5-18", "241C3DA58FECD0945B9687D408766058");
3664  res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &comp);
3665  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
3666 
3667  size = MAX_PATH;
3668  res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3669  NULL, NULL, (LPBYTE)val, &size);
3670  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
3671  ok(!lstrcmpA(val, "01\\msitest\\augustus"),
3672  "Expected \"01\\msitest\\augustus\", got \"%s\"\n", val);
3673 
3674  res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, compkey, 0, access, &hkey);
3675  ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res);
3676 
3677  RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3678  delete_key(comp, "", access);
3679  RegCloseKey(comp);
3680 
3681 error:
3683  DeleteFileA("msitest\\maximus");
3684  RemoveDirectoryA("msitest");
3685  LocalFree(usersid);
3686 }
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4027
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define ERROR_SUCCESS
Definition: deptool.c:10
int WINAPI lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:42
static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
Definition: automation.c:414
#define error(str)
Definition: mkdosfs.c:1605
static LONG delete_key(HKEY key, LPCSTR subkey, REGSAM access)
Definition: action.c:2481
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:200
#define TRUE
Definition: types.h:120
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static char PROG_FILES_DIR[MAX_PATH]
Definition: automation.c:362
char CHAR
Definition: xmlstorage.h:175
#define create_file(name, size)
Definition: asmcache.c:813
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3321
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2284
char * LPSTR
Definition: xmlstorage.h:182
#define sprintf(buf, format,...)
Definition: sprintf.c:55
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
static STATEMGRSTATUS *static BOOL is_wow64
Definition: action.c:61
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
GLuint GLfloat * val
Definition: glext.h:7180
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
GLsizeiptr size
Definition: glext.h:5919
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
static const msi_table ppc_tables[]
Definition: action.c:2014
#define create_database(name, tables, num_tables)
Definition: utils.h:42
static char * get_user_sid(void)
Definition: action.c:2405
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
#define ARRAY_SIZE(a)
Definition: main.h:24
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define ok(value,...)
Definition: atltest.h:57
LONG WINAPI RegDeleteValueA(HKEY hKey, LPCSTR lpValueName)
Definition: reg.c:2319
ACCESS_MASK REGSAM
Definition: winreg.h:69
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define skip(...)
Definition: atltest.h:64
GLuint res
Definition: glext.h:9613
static BOOL is_process_limited(void)
Definition: atl.c:113
#define RegCloseKey(hKey)
Definition: registry.h:47
static const char * msifile
Definition: action.c:66
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by START_TEST().

◆ test_publish()

static void test_publish ( void  )
static

Definition at line 3688 of file action.c.

3689 {
3690  static const char subkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
3691  static const char subkey_32node[] = "Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
3692  UINT r;
3693  LONG res;
3694  HKEY uninstall, prodkey, uninstall_32node = NULL;
3696  char date[MAX_PATH], temp[MAX_PATH], prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
3698  DWORD error;
3699 
3700  if (!pMsiQueryFeatureStateExA)
3701  {
3702  win_skip("MsiQueryFeatureStateExA is not available\n");
3703  return;
3704  }
3705  if (is_process_limited())
3706  {
3707  skip("process is limited\n");
3708  return;
3709  }
3710 
3711  get_date_str(date);
3713 
3714  if (is_wow64)
3716 
3717  res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, subkey, 0, KEY_ALL_ACCESS, &uninstall);
3718  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
3719 
3720  if (is_64bit)
3721  {
3722  res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, subkey_32node, 0, KEY_ALL_ACCESS, &uninstall_32node);
3723  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
3724  }
3725 
3726  CreateDirectoryA("msitest", NULL);
3727  create_file("msitest\\maximus", 500);
3728 
3730 
3732 
3733  state = MsiQueryProductStateA(prodcode);
3734  ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3735 
3736  state = MsiQueryFeatureStateA(prodcode, "feature");
3737  ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3738 
3739  state = 0xdead;
3740  SetLastError(0xdeadbeef);
3741  r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, "feature", &state);
3742  error = GetLastError();
3743  ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
3744  ok(state == 0xdead, "got %d\n", state);
3745  ok(error == 0xdeadbeef, "got %lu\n", error);
3746 
3747  state = 0xdead;
3748  SetLastError(0xdeadbeef);
3749  r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, "feature", &state);
3750  error = GetLastError();
3751  ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
3752  ok(state == 0xdead, "got %d\n", state);
3753  ok(error == ERROR_SUCCESS, "got %lu\n", error);
3754 
3755  state = 0xdead;
3756  SetLastError(0xdeadbeef);
3757  r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "feature", &state);
3758  error = GetLastError();
3759  ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
3760  ok(state == 0xdead, "got %d\n", state);
3761  ok(error == ERROR_SUCCESS, "got %lu\n", error);
3762 
3763  state = MsiQueryFeatureStateA(prodcode, "feature");
3764  ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3765 
3766  state = MsiQueryFeatureStateA(prodcode, "montecristo");
3767  ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3768 
3769  r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3770  "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3771  ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3772  ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3773 
3774  res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3775  ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res);
3776 
3777  /* nothing published */
3780  {
3781  skip("Not enough rights to perform tests\n");
3782  goto error;
3783  }
3784  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3785  ok(pf_exists("msitest\\maximus"), "File not installed\n");
3786  ok(pf_exists("msitest"), "File not installed\n");
3787 
3788  state = MsiQueryProductStateA(prodcode);
3789  ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3790 
3791  state = MsiQueryFeatureStateA(prodcode, "feature");
3792  ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3793 
3794  state = MsiQueryFeatureStateA(prodcode, "montecristo");
3795  ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3796 
3797  r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3798  "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3799  ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3800  ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3801 
3802  res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3803  ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res);
3804 
3805  /* PublishProduct and RegisterProduct */
3806  r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 PUBLISH_PRODUCT=1");
3807  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3808  ok(pf_exists("msitest\\maximus"), "File not installed\n");
3809  ok(pf_exists("msitest"), "File not installed\n");
3810 
3811  state = MsiQueryProductStateA(prodcode);
3812  ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3813 
3814  state = MsiQueryFeatureStateA(prodcode, "feature");
3815  ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3816 
3817  state = MsiQueryFeatureStateA(prodcode, "montecristo");
3818  ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3819 
3820  r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3821  "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3822  ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
3823  ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3824 
3825  if (is_64bit)
3826  {
3827  res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3828  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
3829  }
3830  else
3831  {
3832  res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3833  if (is_wow64 && res == ERROR_FILE_NOT_FOUND) /* XP - Vista, Wow64 */
3834  res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3835  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
3836  }
3837 
3838  CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3839  CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3840  CHECK_REG_STR(prodkey, "InstallDate", date);
3841  CHECK_REG_STR(prodkey, "InstallSource", temp);
3842  CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /X{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3843  CHECK_REG_STR(prodkey, "Publisher", "Wine");
3844  CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /X{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3845  CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", "");
3846  CHECK_REG_STR(prodkey, "Comments", "");
3847  CHECK_REG_STR(prodkey, "Contact", "");
3848  CHECK_REG_STR(prodkey, "HelpLink", "");
3849  CHECK_REG_STR(prodkey, "HelpTelephone", "");
3850  CHECK_REG_STR(prodkey, "InstallLocation", "");
3851  CHECK_REG_DWORD(prodkey, "NoModify", 1);
3852  CHECK_REG_STR(prodkey, "Readme", "");
3853  CHECK_REG_STR(prodkey, "Size", "");
3854  CHECK_REG_STR(prodkey, "URLInfoAbout", "");
3855  CHECK_REG_STR(prodkey, "URLUpdateInfo", "");
3856  CHECK_REG_DWORD(prodkey, "Language", 1033);
3857  CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3858  CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3859  CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3860  CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3861  CHECK_REG_DWORD_TODO(prodkey, "EstimatedSize", get_estimated_size());
3862 
3863  RegCloseKey(prodkey);
3864 
3865  r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
3866  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3867  ok(pf_exists("msitest\\maximus"), "File deleted\n");
3868  ok(pf_exists("msitest"), "File deleted\n");
3869 
3870  state = MsiQueryProductStateA(prodcode);
3871  ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3872 
3873  state = MsiQueryFeatureStateA(prodcode, "feature");
3874  ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3875 
3876  state = MsiQueryFeatureStateA(prodcode, "montecristo");
3877  ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3878 
3879  r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3880  "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3881  ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3882  ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3883 
3884  res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3885  ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res);
3886 
3887  /* complete install */
3888  r = MsiInstallProductA(msifile, "FULL=1");
3889  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3890  ok(pf_exists("msitest\\maximus"), "File not installed\n");
3891  ok(pf_exists("msitest"), "File not installed\n");
3892 
3893  state = MsiQueryProductStateA(prodcode);
3894  ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3895 
3896  state = MsiQueryFeatureStateA(prodcode, "feature");
3897  ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3898 
3899  state = 0xdead;
3900  SetLastError(0xdeadbeef);
3901  r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, "feature", &state);
3902  error = GetLastError();
3903  ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
3904  ok(state == 0xdead, "got %d\n", state);
3905  ok(error == 0xdeadbeef, "got %lu\n", error);
3906 
3907  state = 0xdead;
3908  SetLastError(0xdeadbeef);
3909  r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, "feature", &state);
3910  error = GetLastError();
3911  ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
3912  ok(state == 0xdead, "got %d\n", state);
3913  ok(error == ERROR_SUCCESS, "got %lu\n", error);
3914 
3915  state = 0xdead;
3916  SetLastError(0xdeadbeef);
3917  r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "feature", &state);
3918  error = GetLastError();
3919  ok(r == ERROR_SUCCESS, "got %u\n", r);
3920  ok(state == INSTALLSTATE_LOCAL, "got %d\n", state);
3921  ok(error == ERROR_SUCCESS, "got %lu\n", error);
3922 
3923  state = MsiQueryFeatureStateA(prodcode, "montecristo");
3924  ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3925 
3926  r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3927  "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3928  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3929  ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3930 
3931  if (is_64bit)
3932  {
3933  res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3934  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
3935  }
3936  else
3937  {
3938  res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3939  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
3940  }
3941 
3942  CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3943  CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3944  CHECK_REG_STR(prodkey, "InstallDate", date);
3945  CHECK_REG_STR(prodkey, "InstallSource", temp);
3946  CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /X{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3947  CHECK_REG_STR(prodkey, "Publisher", "Wine");
3948  CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /X{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3949  CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", "");
3950  CHECK_REG_STR(prodkey, "Comments", "");
3951  CHECK_REG_STR(prodkey, "Contact", "");
3952  CHECK_REG_STR(prodkey, "HelpLink", "");
3953  CHECK_REG_STR(prodkey, "HelpTelephone", "");
3954  CHECK_REG_STR(prodkey, "InstallLocation", "");
3955  CHECK_REG_DWORD(prodkey, "NoModify", 1);
3956  CHECK_REG_STR(prodkey, "Readme", "");
3957  CHECK_REG_STR(prodkey, "Size", "");
3958  CHECK_REG_STR(prodkey, "URLInfoAbout", "");
3959  CHECK_REG_STR(prodkey, "URLUpdateInfo", "");
3960  CHECK_REG_DWORD(prodkey, "Language", 1033);
3961  CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3962  CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3963  CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3964  CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3965  CHECK_REG_DWORD_TODO(prodkey, "EstimatedSize", get_estimated_size());
3966 
3967  RegCloseKey(prodkey);
3968 
3969  /* no UnpublishFeatures */
3970  r = MsiInstallProductA(msifile, "REMOVE=ALL");
3971  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3972  ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
3973  ok(!pf_exists("msitest"), "Directory not deleted\n");
3974 
3975  state = MsiQueryProductStateA(prodcode);
3976  ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3977 
3978  state = MsiQueryFeatureStateA(prodcode, "feature");
3979  ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3980 
3981  state = MsiQueryFeatureStateA(prodcode, "montecristo");
3982  ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3983 
3984  r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3985  "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3986  ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3987  ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3988 
3989  res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3990  ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res);
3991 
3992  /* complete install */
3993  r = MsiInstallProductA(msifile, "FULL=1");
3994  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3995  ok(pf_exists("msitest\\maximus"), "File not installed\n");
3996  ok(pf_exists("msitest"), "File not installed\n");
3997 
3998  state = MsiQueryProductStateA(prodcode);
3999  ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4000 
4001  state = MsiQueryFeatureStateA(prodcode, "feature");
4002  ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4003 
4004  state = MsiQueryFeatureStateA(prodcode, "montecristo");
4005  ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4006 
4007  r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4008  "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4009  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4010  ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4011 
4012  if (is_64bit)