ReactOS  0.4.14-dev-50-g13bb5e2
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 "wine/test.h"
Include dependency graph for action.c:

Go to the source code of this file.

Classes

struct  _msi_table
 

Macros

#define _WIN32_MSI   300
 
#define ADD_TABLE(x)   {#x".idt", x##_dat, sizeof(x##_dat)}
 
#define MEDIA_SIZE   0x7FFFFFFF
 
#define FOLDER_THRESHOLD   900000
 
#define GET_PROC(mod, func)
 
#define create_file(name, size)   create_file_data(name, name, size)
 
#define create_database(name, tables, num_tables)   create_database_wordcount(name, tables, num_tables, 100, 0, ";1033");
 
#define create_database_template(name, tables, num_tables, version, template)   create_database_wordcount(name, tables, num_tables, version, 0, template);
 
#define CHECK_REG_STR(prodkey, name, expected)   check_reg_str(prodkey, name, expected, TRUE, __LINE__);
 
#define CHECK_DEL_REG_STR(prodkey, name, expected)
 
#define CHECK_REG_ISTR(prodkey, name, expected)   check_reg_str(prodkey, name, expected, FALSE, __LINE__);
 
#define CHECK_DEL_REG_ISTR(prodkey, name, expected)
 
#define CHECK_REG_DWORD(prodkey, name, expected)   check_reg_dword(prodkey, name, expected, __LINE__);
 
#define CHECK_DEL_REG_DWORD(prodkey, name, expected)
 
#define CHECK_REG_DWORD2(prodkey, name, expected1, expected2)   check_reg_dword2(prodkey, name, expected1, expected2, __LINE__);
 
#define CHECK_DEL_REG_DWORD2(prodkey, name, expected1, expected2)
 
#define CHECK_REG_DWORD4(prodkey, name, expected1, expected2, expected3, expected4)   check_reg_dword4(prodkey, name, expected1, expected2, expected3, expected4, __LINE__);
 
#define CHECK_DEL_REG_DWORD5(prodkey, name, expected1, expected2, expected3, expected4, expected5)
 
#define create_pf(file, is_file)   create_pf_data(file, file, is_file)
 

Typedefs

typedef struct _msi_table msi_table
 

Functions

static UINT (WINAPI *pMsiQueryComponentStateA)(LPCSTR
 
static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)(LPCSTR
 
static INSTALLSTATE *static BOOL (WINAPI *pCheckTokenMembership)(HANDLE
 
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY
 
static LSTATUS action_RegDeleteTreeA (HKEY hKey, LPCSTR lpszSubKey, REGSAM access)
 
static void *CDECL mem_alloc (ULONG cb)
 
static void CDECL mem_free (void *memory)
 
static BOOL CDECL get_next_cabinet (PCCAB pccab, ULONG cbPrevCab, void *pv)
 
static LONG CDECL progress (UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
 
static int CDECL file_placed (PCCAB pccab, char *pszFile, LONG cbFile, BOOL fContinuation, void *pv)
 
static INT_PTR CDECL fci_open (char *pszFile, int oflag, int pmode, int *err, void *pv)
 
static UINT CDECL fci_read (INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
 
static UINT CDECL fci_write (INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
 
static int CDECL fci_close (INT_PTR hf, int *err, void *pv)
 
static LONG CDECL fci_seek (INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
 
static int CDECL fci_delete (char *pszFile, int *err, void *pv)
 
static void init_functionpointers (void)
 
static BOOL is_process_limited (void)
 
static charget_user_sid (void)
 
static BOOL CDECL get_temp_file (char *pszTempName, int cbTempName, void *pv)
 
static INT_PTR CDECL get_open_info (char *pszName, USHORT *pdate, USHORT *ptime, USHORT *pattribs, int *err, void *pv)
 
static BOOL add_file (HFCI hfci, const char *file, TCOMP compress)
 
static void set_cab_parameters (PCCAB pCabParams, const CHAR *name, DWORD max_size)
 
static void create_cab_file (const CHAR *name, DWORD max_size, const CHAR *files)
 
static BOOL get_user_dirs (void)
 
static BOOL get_system_dirs (void)
 
static void create_file_data (LPCSTR name, LPCSTR data, DWORD size)
 
static void create_test_files (void)
 
static BOOL delete_pf (const CHAR *rel_path, BOOL is_file)
 
static void delete_test_files (void)
 
static void write_file (const CHAR *filename, const char *data, int data_size)
 
static void write_msi_summary_info (MSIHANDLE db, INT version, INT wordcount, const char *template)
 
static void create_database_wordcount (const CHAR *name, const msi_table *tables, int num_tables, INT version, INT wordcount, const char *template)
 
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 BOOL file_exists (LPCSTR file)
 
static BOOL pf_exists (LPCSTR file)
 
static void delete_pfmsitest_files (void)
 
static void check_reg_str (HKEY prodkey, LPCSTR name, LPCSTR expected, BOOL bcase, DWORD line)
 
static void check_reg_dword (HKEY prodkey, LPCSTR name, DWORD expected, DWORD line)
 
static void check_reg_dword4 (HKEY prodkey, LPCSTR name, DWORD expected1, DWORD expected2, DWORD expected3, DWORD expected4, DWORD line)
 
static void check_reg_dword5 (HKEY prodkey, LPCSTR name, DWORD expected1, DWORD expected2, DWORD expected3, DWORD expected4, DWORD expected5, DWORD line)
 
static void get_date_str (LPSTR date)
 
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 create_pf_data (LPCSTR file, LPCSTR data, BOOL is_file)
 
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_remove_registry_values (void)
 
static void test_find_related_products (void)
 
static void test_remove_ini_values (void)
 
static void test_remove_env_strings (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 PSID
 
static INSTALLSTATE *static PBOOL
 
static LPSTR *static PHANDLE
 
static REGSAM
 
static HMODULE hsrclient
 
static STATEMGRSTATUS *static BOOL is_wow64
 
static const BOOL is_64bit = sizeof(void *) > sizeof(int)
 
static const charmsifile = "msitest.msi"
 
static CHAR CURR_DIR [MAX_PATH]
 
static CHAR PROG_FILES_DIR [MAX_PATH]
 
static CHAR COMMON_FILES_DIR [MAX_PATH]
 
static CHAR APP_DATA_DIR [MAX_PATH]
 
static CHAR WINDOWS_DIR [MAX_PATH]
 
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 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 sds_install_exec_seq_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_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 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 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 sr_selfreg_dat []
 
static const char sr_install_exec_seq_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 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_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 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 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 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 rrv_file_dat []
 
static const char rrv_feature_dat []
 
static const char rrv_feature_comp_dat []
 
static const char rrv_component_dat []
 
static const char rrv_registry_dat []
 
static const char rrv_remove_registry_dat []
 
static const char rrv_install_exec_seq_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 riv_file_dat []
 
static const char riv_feature_dat []
 
static const char riv_feature_comp_dat []
 
static const char riv_component_dat []
 
static const char riv_ini_file_dat []
 
static const char riv_remove_ini_file_dat []
 
static const char riv_install_exec_seq_dat []
 
static const char res_file_dat []
 
static const char res_feature_dat []
 
static const char res_feature_comp_dat []
 
static const char res_component_dat []
 
static const char res_environment_dat []
 
static const char res_install_exec_seq_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 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 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 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 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 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 rrv_tables []
 
static const msi_table frp_tables []
 
static const msi_table riv_tables []
 
static const msi_table res_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.

◆ ADD_TABLE

#define ADD_TABLE (   x)    {#x".idt", x##_dat, sizeof(x##_dat)}

Definition at line 1689 of file action.c.

◆ CHECK_DEL_REG_DWORD

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

Definition at line 2835 of file action.c.

◆ CHECK_DEL_REG_DWORD2

#define CHECK_DEL_REG_DWORD2 (   prodkey,
  name,
  expected1,
  expected2 
)
Value:
do { \
check_reg_dword2(prodkey, name, expected1, expected2, __LINE__); \
RegDeleteValueA(prodkey, name); \
} while(0)
static const WCHAR expected2[]
Definition: dir.c:143
static const WCHAR expected1[]
Definition: dir.c:142
Definition: name.c:36

Definition at line 2844 of file action.c.

◆ CHECK_DEL_REG_DWORD5

#define CHECK_DEL_REG_DWORD5 (   prodkey,
  name,
  expected1,
  expected2,
  expected3,
  expected4,
  expected5 
)
Value:
do { \
check_reg_dword5(prodkey, name, expected1, expected2, expected3, expected4, expected5, __LINE__); \
RegDeleteValueA(prodkey, name); \
} while(0)
static const WCHAR expected2[]
Definition: dir.c:143
static const WCHAR expected4[]
Definition: dir.c:145
static const WCHAR expected1[]
Definition: dir.c:142
static const WCHAR expected3[]
Definition: dir.c:144
static const WCHAR expected5[]
Definition: dir.c:146
Definition: name.c:36

Definition at line 2853 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, __LINE__); \
RegDeleteValueA(prodkey, name); \
} while(0)
Definition: name.c:36
BOOL expected
Definition: store.c:2063

Definition at line 2826 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, __LINE__); \
RegDeleteValueA(prodkey, name); \
} while(0)
#define TRUE
Definition: types.h:120
Definition: name.c:36
BOOL expected
Definition: store.c:2063

Definition at line 2817 of file action.c.

◆ CHECK_REG_DWORD

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

Definition at line 2832 of file action.c.

◆ CHECK_REG_DWORD2

#define CHECK_REG_DWORD2 (   prodkey,
  name,
  expected1,
  expected2 
)    check_reg_dword2(prodkey, name, expected1, expected2, __LINE__);

Definition at line 2841 of file action.c.

◆ CHECK_REG_DWORD4

#define CHECK_REG_DWORD4 (   prodkey,
  name,
  expected1,
  expected2,
  expected3,
  expected4 
)    check_reg_dword4(prodkey, name, expected1, expected2, expected3, expected4, __LINE__);

Definition at line 2850 of file action.c.

◆ CHECK_REG_ISTR

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

Definition at line 2823 of file action.c.

◆ CHECK_REG_STR

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

Definition at line 2814 of file action.c.

◆ create_database

#define create_database (   name,
  tables,
  num_tables 
)    create_database_wordcount(name, tables, num_tables, 100, 0, ";1033");

Definition at line 2620 of file action.c.

◆ create_database_template

#define create_database_template (   name,
  tables,
  num_tables,
  version,
  template 
)    create_database_wordcount(name, tables, num_tables, version, 0, template);

Definition at line 2623 of file action.c.

◆ create_file

#define create_file (   name,
  size 
)    create_file_data(name, name, size)

Definition at line 2529 of file action.c.

◆ create_pf

#define create_pf (   file,
  is_file 
)    create_pf_data(file, file, is_file)

Definition at line 4632 of file action.c.

◆ FOLDER_THRESHOLD

#define FOLDER_THRESHOLD   900000

Definition at line 2155 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:410
GLfloat GLfloat p
Definition: glext.h:8902
static int mod
Definition: i386-dis.c:1273

◆ MEDIA_SIZE

#define MEDIA_SIZE   0x7FFFFFFF

Definition at line 2154 of file action.c.

Typedef Documentation

◆ msi_table

Function Documentation

◆ action_RegDeleteTreeA()

static LSTATUS action_RegDeleteTreeA ( HKEY  hKey,
LPCSTR  lpszSubKey,
REGSAM  access 
)
static

Definition at line 2083 of file action.c.

2084 {
2085  LONG ret;
2086  DWORD dwMaxSubkeyLen, dwMaxValueLen;
2087  DWORD dwMaxLen, dwSize;
2088  char szNameBuf[MAX_PATH], *lpszName = szNameBuf;
2089  HKEY hSubKey = hKey;
2090 
2091  if(lpszSubKey)
2092  {
2093  ret = RegOpenKeyExA(hKey, lpszSubKey, 0, access, &hSubKey);
2094  if (ret) return ret;
2095  }
2096 
2097  ret = RegQueryInfoKeyA(hSubKey, NULL, NULL, NULL, NULL,
2098  &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
2099  if (ret) goto cleanup;
2100 
2101  dwMaxSubkeyLen++;
2102  dwMaxValueLen++;
2103  dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
2104  if (dwMaxLen > sizeof(szNameBuf))
2105  {
2106  /* Name too big: alloc a buffer for it */
2107  if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen)))
2108  {
2110  goto cleanup;
2111  }
2112  }
2113 
2114  /* Recursively delete all the subkeys */
2115  while (TRUE)
2116  {
2117  dwSize = dwMaxLen;
2118  if (RegEnumKeyExA(hSubKey, 0, lpszName, &dwSize, NULL,
2119  NULL, NULL, NULL)) break;
2120 
2121  ret = action_RegDeleteTreeA(hSubKey, lpszName, access);
2122  if (ret) goto cleanup;
2123  }
2124 
2125  if (lpszSubKey)
2126  {
2127  if (pRegDeleteKeyExA)
2128  ret = pRegDeleteKeyExA(hKey, lpszSubKey, access, 0);
2129  else
2130  ret = RegDeleteKeyA(hKey, lpszSubKey);
2131  }
2132  else
2133  while (TRUE)
2134  {
2135  dwSize = dwMaxLen;
2136  if (RegEnumValueA(hKey, 0, lpszName, &dwSize,
2137  NULL, NULL, NULL, NULL)) break;
2138 
2139  ret = RegDeleteValueA(hKey, lpszName);
2140  if (ret) goto cleanup;
2141  }
2142 
2143 cleanup:
2144  if (lpszName != szNameBuf)
2145  HeapFree(GetProcessHeap(), 0, lpszName);
2146  if(lpszSubKey)
2147  RegCloseKey(hSubKey);
2148  return ret;
2149 }
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
LONG WINAPI RegQueryInfoKeyA(HKEY hKey, LPSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3607
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3331
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
static LSTATUS action_RegDeleteTreeA(HKEY hKey, LPCSTR lpszSubKey, REGSAM access)
Definition: action.c:2083
LONG WINAPI RegEnumValueA(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpdwReserved, _Out_opt_ LPDWORD lpdwType, _Out_opt_ LPBYTE lpData, _Inout_opt_ LPDWORD lpcbData)
Definition: reg.c:2691
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1222
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
LONG WINAPI RegDeleteValueA(HKEY hKey, LPCSTR lpValueName)
Definition: reg.c:2319
char * cleanup(char *str)
Definition: wpickclick.c:99
#define HeapFree(x, y, z)
Definition: compat.h:394
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
LONG WINAPI RegEnumKeyExA(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2442

Referenced by test_write_registry_values().

◆ add_file()

static BOOL add_file ( HFCI  hfci,
const char file,
TCOMP  compress 
)
static

Definition at line 2397 of file action.c.

2398 {
2399  char path[MAX_PATH];
2400  char filename[MAX_PATH];
2401 
2403  lstrcatA(path, "\\");
2404  lstrcatA(path, file);
2405 
2407 
2408  return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet,
2410 }
static CHAR CURR_DIR[MAX_PATH]
Definition: action.c:63
const char * filename
Definition: ioapi.h:135
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
Definition: compress.c:68
#define MAX_PATH
Definition: compat.h:26
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
Definition: services.c:325
static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
Definition: action.c:2169
BOOL __cdecl FCIAddFile(HFCI hfci, char *pszSourceFile, char *pszFileName, BOOL fExecute, PFNFCIGETNEXTCABINET pfnfcignc, PFNFCISTATUS pfnfcis, PFNFCIGETOPENINFO pfnfcigoi, TCOMP typeCompress)
Definition: fci.c:1397
static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime, USHORT *pattribs, int *err, void *pv)
Definition: action.c:2371
static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
Definition: action.c:2175
Definition: fci.c:126

Referenced by create_cab_file().

◆ BOOL()

static INSTALLSTATE* static BOOL ( WINAPI pCheckTokenMembership)
static

◆ check_reg_dword()

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

Definition at line 2758 of file action.c.

2759 {
2760  DWORD val, size, type;
2761  LONG res;
2762 
2763  size = sizeof(DWORD);
2764  res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
2765 
2766  if (res != ERROR_SUCCESS || type != REG_DWORD)
2767  {
2768  ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2769  return;
2770  }
2771 
2772  ok_(__FILE__, line)(val == expected, "Expected %d, got %d\n", expected, val);
2773 }
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:4023
#define ERROR_SUCCESS
Definition: deptool.c:10
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
unsigned char * LPBYTE
Definition: typedefs.h:52
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
GLuint GLfloat * val
Definition: glext.h:7180
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
static INSTALLSTATE *static DWORD
Definition: action.c:41
Definition: name.c:36
GLuint res
Definition: glext.h:9613
#define REG_DWORD
Definition: sdbapi.c:596
BOOL expected
Definition: store.c:2063
#define ok_(x1, x2)
Definition: atltest.h:61

◆ check_reg_dword4()

static void check_reg_dword4 ( HKEY  prodkey,
LPCSTR  name,
DWORD  expected1,
DWORD  expected2,
DWORD  expected3,
DWORD  expected4,
DWORD  line 
)
static

Definition at line 2775 of file action.c.

2777 {
2778  DWORD val, size, type;
2779  LONG res;
2780 
2781  size = sizeof(DWORD);
2782  res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
2783 
2784  if (res != ERROR_SUCCESS || type != REG_DWORD)
2785  {
2786  ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2787  return;
2788  }
2789 
2790  ok_(__FILE__, line)(val == expected1 || val == expected2 || val == expected3 || val == expected4,
2791  "Expected %d, %d, %d or %d, got %d\n", expected1, expected2, expected3, expected4, val);
2792 }
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:4023
#define ERROR_SUCCESS
Definition: deptool.c:10
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static const WCHAR expected2[]
Definition: dir.c:143
unsigned char * LPBYTE
Definition: typedefs.h:52
long LONG
Definition: pedump.c:60
static const WCHAR expected4[]
Definition: dir.c:145
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
GLuint GLfloat * val
Definition: glext.h:7180
GLsizeiptr size
Definition: glext.h:5919
static const WCHAR expected1[]
Definition: dir.c:142
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR expected3[]
Definition: dir.c:144
static INSTALLSTATE *static DWORD
Definition: action.c:41
Definition: name.c:36
GLuint res
Definition: glext.h:9613
#define REG_DWORD
Definition: sdbapi.c:596
#define ok_(x1, x2)
Definition: atltest.h:61

◆ check_reg_dword5()

static void check_reg_dword5 ( HKEY  prodkey,
LPCSTR  name,
DWORD  expected1,
DWORD  expected2,
DWORD  expected3,
DWORD  expected4,
DWORD  expected5,
DWORD  line 
)
static

Definition at line 2794 of file action.c.

2796 {
2797  DWORD val, size, type;
2798  LONG res;
2799 
2800  size = sizeof(DWORD);
2801  res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
2802 
2803  if (res != ERROR_SUCCESS || type != REG_DWORD)
2804  {
2805  ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2806  return;
2807  }
2808 
2809  ok_(__FILE__, line)(val == expected1 || val == expected2 || val == expected3 || val == expected4 ||
2810  val == expected5,
2811  "Expected %d, %d, %d, %d or %d, got %d\n", expected1, expected2, expected3, expected4, expected5, val);
2812 }
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:4023
#define ERROR_SUCCESS
Definition: deptool.c:10
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static const WCHAR expected2[]
Definition: dir.c:143
unsigned char * LPBYTE
Definition: typedefs.h:52
long LONG
Definition: pedump.c:60
static const WCHAR expected4[]
Definition: dir.c:145
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
GLuint GLfloat * val
Definition: glext.h:7180
GLsizeiptr size
Definition: glext.h:5919
static const WCHAR expected1[]
Definition: dir.c:142
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR expected3[]
Definition: dir.c:144
static const WCHAR expected5[]
Definition: dir.c:146
static INSTALLSTATE *static DWORD
Definition: action.c:41
Definition: name.c:36
GLuint res
Definition: glext.h:9613
#define REG_DWORD
Definition: sdbapi.c:596
#define ok_(x1, x2)
Definition: atltest.h:61

◆ check_reg_str()

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

Definition at line 2730 of file action.c.

2731 {
2732  char val[MAX_PATH];
2733  DWORD size, type;
2734  LONG res;
2735 
2736  size = MAX_PATH;
2737  val[0] = '\0';
2738  res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)val, &size);
2739 
2740  if (res != ERROR_SUCCESS ||
2741  (type != REG_SZ && type != REG_EXPAND_SZ && type != REG_MULTI_SZ))
2742  {
2743  ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2744  return;
2745  }
2746 
2747  if (!expected)
2748  ok_(__FILE__, line)(!val[0], "Expected empty string, got %s\n", val);
2749  else
2750  {
2751  if (bcase)
2752  ok_(__FILE__, line)(!lstrcmpA(val, expected), "Expected %s, got %s\n", expected, val);
2753  else
2754  ok_(__FILE__, line)(!lstrcmpiA(val, expected), "Expected %s, got %s\n", expected, val);
2755  }
2756 }
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:4023
#define ERROR_SUCCESS
Definition: deptool.c:10
int WINAPI lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:42
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
unsigned char * LPBYTE
Definition: typedefs.h:52
long LONG
Definition: pedump.c:60
#define REG_MULTI_SZ
Definition: nt_native.h:1501
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
GLuint GLfloat * val
Definition: glext.h:7180
GLsizeiptr size
Definition: glext.h:5919
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
Definition: name.c:36
GLuint res
Definition: glext.h:9613
BOOL expected
Definition: store.c:2063
#define ok_(x1, x2)
Definition: atltest.h:61
#define REG_SZ
Definition: layer.c:22

◆ create_cab_file()

static void create_cab_file ( const CHAR name,
DWORD  max_size,
const CHAR files 
)
static

Definition at line 2425 of file action.c.

2426 {
2427  CCAB cabParams;
2428  LPCSTR ptr;
2429  HFCI hfci;
2430  ERF erf;
2431  BOOL res;
2432 
2433  set_cab_parameters(&cabParams, name, max_size);
2434 
2437  get_temp_file, &cabParams, NULL);
2438 
2439  ok(hfci != NULL, "Failed to create an FCI context\n");
2440 
2441  ptr = files;
2442  while (*ptr)
2443  {
2444  res = add_file(hfci, ptr, tcompTYPE_MSZIP);
2445  ok(res, "Failed to add file: %s\n", ptr);
2446  ptr += lstrlenA(ptr) + 1;
2447  }
2448 
2450  ok(res, "Failed to flush the cabinet\n");
2451 
2452  res = FCIDestroy(hfci);
2453  ok(res, "Failed to destroy the cabinet\n");
2454 }
static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
Definition: action.c:2352
BOOL __cdecl FCIFlushCabinet(HFCI hfci, BOOL fGetNextCab, PFNFCIGETNEXTCABINET pfnfcignc, PFNFCISTATUS pfnfcis)
Definition: fci.c:1675
HFCI __cdecl FCICreate(PERF perf, PFNFCIFILEPLACED pfnfiledest, PFNFCIALLOC pfnalloc, PFNFCIFREE pfnfree, PFNFCIOPEN pfnopen, PFNFCIREAD pfnread, PFNFCIWRITE pfnwrite, PFNFCICLOSE pfnclose, PFNFCISEEK pfnseek, PFNFCIDELETE pfndelete, PFNFCIGETTEMPFILE pfnfcigtf, PCCAB pccab, void *pv)
Definition: fci.c:998
BOOL __cdecl FCIDestroy(HFCI hfci)
Definition: fci.c:1709
static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
Definition: action.c:2233
Definition: fci.h:144
#define tcompTYPE_MSZIP
Definition: fci.h:65
static void CDECL mem_free(void *memory)
Definition: action.c:2164
unsigned int BOOL
Definition: ntddk_ex.h:94
static void *CDECL mem_alloc(ULONG cb)
Definition: action.c:2159
Definition: fci.h:44
static PVOID ptr
Definition: dispmode.c:27
static INT max_size
Definition: history.c:51
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
Definition: action.c:2221
static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
Definition: action.c:2241
static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
Definition: action.c:2397
double __cdecl erf(double)
static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile, BOOL fContinuation, void *pv)
Definition: action.c:2180
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
static int CDECL fci_delete(char *pszFile, int *err, void *pv)
Definition: action.c:2252
#define ok(value,...)
Definition: atltest.h:57
static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
Definition: action.c:2169
Definition: name.c:36
GLuint res
Definition: glext.h:9613
static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
Definition: action.c:2412
static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
Definition: action.c:2186
static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
Definition: action.c:2209
static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
Definition: action.c:2175

Referenced by create_test_files().

◆ create_database_wordcount()

static void create_database_wordcount ( const CHAR name,
const msi_table tables,
int  num_tables,
INT  version,
INT  wordcount,
const char template 
)
static

Definition at line 2626 of file action.c.

2629 {
2630  MSIHANDLE db;
2631  UINT r;
2632  WCHAR *nameW;
2633  int j, len;
2634 
2635  len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
2636  if (!(nameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return;
2637  MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, len );
2638 
2640  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2641 
2642  /* import the tables into the database */
2643  for (j = 0; j < num_tables; j++)
2644  {
2645  const msi_table *table = &tables[j];
2646 
2647  write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
2648 
2649  r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
2650  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2651 
2652  DeleteFileA(table->filename);
2653  }
2654 
2655  write_msi_summary_info(db, version, wordcount, template);
2656 
2657  r = MsiDatabaseCommit(db);
2658  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2659 
2660  MsiCloseHandle(db);
2661  HeapFree( GetProcessHeap(), 0, nameW );
2662 }
static CHAR CURR_DIR[MAX_PATH]
Definition: action.c:63
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define CP_ACP
Definition: compat.h:99
unsigned long MSIHANDLE
Definition: msiserver.idl:25
static void write_file(const CHAR *filename, const char *data, int data_size)
Definition: action.c:2581
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR version[]
Definition: asmname.c:64
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
static const WCHAR nameW[]
Definition: main.c:46
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
static void write_msi_summary_info(MSIHANDLE db, INT version, INT wordcount, const char *template)
Definition: action.c:2589
#define MSIDBOPEN_CREATE
Definition: msiquery.h:69
GLenum GLsizei len
Definition: glext.h:6722
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
BYTE * data
UINT WINAPI MsiDatabaseCommit(MSIHANDLE hdb)
Definition: msiquery.c:813
#define ok(value,...)
Definition: atltest.h:57
UINT WINAPI MsiOpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIHANDLE *phDB)
Definition: database.c:303
unsigned int UINT
Definition: ndis.h:50
#define MultiByteToWideChar
Definition: compat.h:100
Definition: name.c:36
struct nls_table * tables
Definition: nls_base.c:22
#define HeapFree(x, y, z)
Definition: compat.h:394
UINT WINAPI MsiDatabaseImportA(MSIHANDLE handle, LPCSTR szFolder, LPCSTR szFilename)
Definition: database.c:900

◆ create_file_data()

static void create_file_data ( LPCSTR  name,
LPCSTR  data,
DWORD  size 
)
static

Definition at line 2509 of file action.c.

2510 {
2511  HANDLE file;
2512  DWORD written;
2513 
2515  if (file == INVALID_HANDLE_VALUE)
2516  return;
2517 
2518  WriteFile(file, data, strlen(data), &written, NULL);
2519 
2520  if (size)
2521  {
2523  SetEndOfFile(file);
2524  }
2525 
2526  CloseHandle(file);
2527 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
#define CloseHandle
Definition: compat.h:398
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
BOOL WINAPI SetEndOfFile(HANDLE hFile)
Definition: fileinfo.c:1154
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI DECLSPEC_HOTPATCH SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod)
Definition: fileinfo.c:204
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
const char file[]
Definition: icontest.c:11
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define CREATE_ALWAYS
Definition: disk.h:72
#define FILE_BEGIN
Definition: winbase.h:112
Definition: name.c:36
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399
Definition: fci.c:126

Referenced by create_pf_data(), and test_publish_assemblies().

◆ create_pf_data()

static void create_pf_data ( LPCSTR  file,
LPCSTR  data,
BOOL  is_file 
)
static

Definition at line 4618 of file action.c.

4619 {
4620  CHAR path[MAX_PATH];
4621 
4623  lstrcatA(path, "\\");
4624  lstrcatA(path, file);
4625 
4626  if (is_file)
4627  create_file_data(path, data, 500);
4628  else
4630 }
static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
Definition: action.c:2509
char CHAR
Definition: xmlstorage.h:175
static CHAR PROG_FILES_DIR[MAX_PATH]
Definition: action.c:64
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
smooth NULL
Definition: ftsmooth.c:416
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
#define MAX_PATH
Definition: compat.h:26
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
Definition: services.c:325
Definition: fci.c:126

◆ create_test_files()

static void create_test_files ( void  )
static

Definition at line 2531 of file action.c.

2532 {
2533  CreateDirectoryA("msitest", NULL);
2534  create_file("msitest\\one.txt", 100);
2535  CreateDirectoryA("msitest\\first", NULL);
2536  create_file("msitest\\first\\two.txt", 100);
2537  CreateDirectoryA("msitest\\second", NULL);
2538  create_file("msitest\\second\\three.txt", 100);
2539 
2540  create_file("four.txt", 100);
2541  create_file("five.txt", 100);
2542  create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
2543 
2544  create_file("msitest\\filename", 100);
2545  create_file("msitest\\service.exe", 100);
2546  create_file("msitest\\service2.exe", 100);
2547 
2548  DeleteFileA("four.txt");
2549  DeleteFileA("five.txt");
2550 }
#define MEDIA_SIZE
Definition: action.c:2154
#define create_file(name, size)
Definition: action.c:2529
static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
Definition: action.c:2425
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24

Referenced by test_create_remove_shortcut(), test_delete_services(), test_envvar(), test_find_related_products(), 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_env_strings(), test_remove_existing_products(), test_remove_ini_values(), test_remove_registry_values(), 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 2685 of file action.c.

2686 {
2687  if (pRegDeleteKeyExA)
2688  return pRegDeleteKeyExA( key, subkey, access, 0 );
2689  return RegDeleteKeyA( key, subkey );
2690 }
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1222
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
Definition: path.c:42

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

◆ delete_pf()

static BOOL delete_pf ( const CHAR rel_path,
BOOL  is_file 
)
static

Definition at line 2552 of file action.c.

2553 {
2554  CHAR path[MAX_PATH];
2555 
2557  lstrcatA(path, "\\");
2558  lstrcatA(path, rel_path);
2559 
2560  if (is_file)
2561  return DeleteFileA(path);
2562  else
2563  return RemoveDirectoryA(path);
2564 }
char CHAR
Definition: xmlstorage.h:175
static CHAR PROG_FILES_DIR[MAX_PATH]
Definition: action.c:64
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
#define MAX_PATH
Definition: compat.h:26
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
Definition: services.c:325
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714

Referenced by test_create_remove_shortcut(), test_delete_services(), test_duplicate_files(), test_envvar(), test_find_related_products(), test_install_remove_odbc(), test_install_services(), test_move_files(), test_process_components(), test_publish_components(), test_publish_features(), test_publish_product(), test_register_class_info(), test_register_extension_info(), test_register_font(), test_register_mime_info(), test_register_product(), test_register_progid_info(), test_register_typelib(), test_register_user(), test_remove_duplicate_files(), test_remove_env_strings(), test_remove_existing_products(), test_remove_files(), test_remove_ini_values(), test_remove_registry_values(), test_self_registration(), test_start_stop_services(), test_validate_product_id(), and test_write_registry_values().

◆ delete_pfmsitest_files()

static void delete_pfmsitest_files ( void  )
static

Definition at line 2708 of file action.c.

2709 {
2710  SHFILEOPSTRUCTA shfl;
2711  CHAR path[MAX_PATH+11];
2712 
2714  lstrcatA(path, "\\msitest\\*");
2715  path[strlen(path) + 1] = '\0';
2716 
2717  shfl.hwnd = NULL;
2718  shfl.wFunc = FO_DELETE;
2719  shfl.pFrom = path;
2720  shfl.pTo = NULL;
2722 
2723  SHFileOperationA(&shfl);
2724 
2726  lstrcatA(path, "\\msitest");
2728 }
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
char CHAR
Definition: xmlstorage.h:175
#define FOF_NOERRORUI
Definition: shellapi.h:148
static CHAR PROG_FILES_DIR[MAX_PATH]
Definition: action.c:64
#define FOF_NOCONFIRMATION
Definition: shellapi.h:142
smooth NULL
Definition: ftsmooth.c:416
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:26
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
Definition: services.c:325
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
int WINAPI SHFileOperationA(LPSHFILEOPSTRUCTA lpFileOp)
Definition: shlfileop.cpp:1000
#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 2566 of file action.c.

2567 {
2568  DeleteFileA("msitest.msi");
2569  DeleteFileA("msitest.cab");
2570  DeleteFileA("msitest\\second\\three.txt");
2571  DeleteFileA("msitest\\first\\two.txt");
2572  DeleteFileA("msitest\\one.txt");
2573  DeleteFileA("msitest\\service.exe");
2574  DeleteFileA("msitest\\service2.exe");
2575  DeleteFileA("msitest\\filename");
2576  RemoveDirectoryA("msitest\\second");
2577  RemoveDirectoryA("msitest\\first");
2578  RemoveDirectoryA("msitest");
2579 }
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_envvar(), test_find_related_products(), 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_env_strings(), test_remove_existing_products(), test_remove_ini_values(), test_remove_registry_values(), 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 5456 of file action.c.

5457 {
5458  BOOL ret;
5459  SC_HANDLE manager, service;
5460 
5462  ok(manager != NULL, "can't open service manager\n");
5463  if (!manager) return;
5464 
5465  service = OpenServiceA(manager, name, GENERIC_ALL);
5466  if (service)
5467  {
5468  ret = DeleteService( service );
5469  ok( ret, "failed to delete service %u\n", GetLastError() );
5470  CloseServiceHandle(service);
5471  }
5472  CloseServiceHandle(manager);
5473 }
#define GENERIC_ALL
Definition: nt_native.h:92
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI DeleteService(SC_HANDLE hService)
Definition: scm.c:916
SC_HANDLE WINAPI OpenSCManagerA(LPCSTR lpMachineName, LPCSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:1967
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:577
smooth NULL
Definition: ftsmooth.c:416
int ret
#define ok(value,...)
Definition: atltest.h:57
#define SC_MANAGER_ALL_ACCESS
Definition: winsvc.h:13
SC_HANDLE WINAPI OpenServiceA(SC_HANDLE hSCManager, LPCSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:2055
Definition: name.c:36

Referenced by test_delete_services(), and test_install_services().

◆ fci_close()

static int CDECL fci_close ( INT_PTR  hf,
int err,
void pv 
)
static

Definition at line 2233 of file action.c.

2234 {
2235  HANDLE handle = (HANDLE)hf;
2236  ok(CloseHandle(handle), "Failed to CloseHandle\n");
2237 
2238  return 0;
2239 }
#define CloseHandle
Definition: compat.h:398
PVOID HANDLE
Definition: typedefs.h:71
#define ok(value,...)
Definition: atltest.h:57

Referenced by create_cab_file().

◆ fci_delete()

static int CDECL fci_delete ( char pszFile,
int err,
void pv 
)
static

Definition at line 2252 of file action.c.

2253 {
2254  BOOL ret = DeleteFileA(pszFile);
2255  ok(ret, "Failed to DeleteFile %s\n", pszFile);
2256 
2257  return 0;
2258 }
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
int ret
#define ok(value,...)
Definition: atltest.h:57

Referenced by create_cab_file().

◆ fci_open()

static INT_PTR CDECL fci_open ( char pszFile,
int  oflag,
int  pmode,
int err,
void pv 
)
static

Definition at line 2186 of file action.c.

2187 {
2188  HANDLE handle;
2189  DWORD dwAccess = 0;
2190  DWORD dwShareMode = 0;
2191  DWORD dwCreateDisposition = OPEN_EXISTING;
2192 
2193  dwAccess = GENERIC_READ | GENERIC_WRITE;
2195 
2197  dwCreateDisposition = OPEN_EXISTING;
2198  else
2199  dwCreateDisposition = CREATE_NEW;
2200 
2201  handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
2202  dwCreateDisposition, 0, NULL);
2203 
2204  ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
2205 
2206  return (INT_PTR)handle;
2207 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
int32_t INT_PTR
Definition: typedefs.h:62
#define FILE_SHARE_READ
Definition: compat.h:125
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:786
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:426
unsigned long DWORD
Definition: ntddk_ex.h:95
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
#define GENERIC_READ
Definition: compat.h:124
#define ok(value,...)
Definition: atltest.h:57
#define CREATE_NEW
Definition: disk.h:69
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399

Referenced by create_cab_file().

◆ fci_read()

static UINT CDECL fci_read ( INT_PTR  hf,
void memory,
UINT  cb,
int err,
void pv 
)
static

Definition at line 2209 of file action.c.

2210 {
2211  HANDLE handle = (HANDLE)hf;
2212  DWORD dwRead;
2213  BOOL res;
2214 
2215  res = ReadFile(handle, memory, cb, &dwRead, NULL);
2216  ok(res, "Failed to ReadFile\n");
2217 
2218  return dwRead;
2219 }
static char memory[1024 *256]
Definition: process.c:116
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
PVOID HANDLE
Definition: typedefs.h:71
static DWORD cb
Definition: integrity.c:41
#define ok(value,...)
Definition: atltest.h:57
GLuint res
Definition: glext.h:9613
BOOL WINAPI ReadFile(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead, OUT LPDWORD lpNumberOfBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:123

Referenced by create_cab_file().

◆ fci_seek()

static LONG CDECL fci_seek ( INT_PTR  hf,
LONG  dist,
int  seektype,
int err,
void pv 
)
static

Definition at line 2241 of file action.c.

2242 {
2243  HANDLE handle = (HANDLE)hf;
2244  DWORD ret;
2245 
2246  ret = SetFilePointer(handle, dist, NULL, seektype);
2247  ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
2248 
2249  return ret;
2250 }
#define INVALID_SET_FILE_POINTER
Definition: winbase.h:115
DWORD WINAPI DECLSPEC_HOTPATCH SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod)
Definition: fileinfo.c:204
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
PVOID HANDLE
Definition: typedefs.h:71
int ret
#define ok(value,...)
Definition: atltest.h:57

Referenced by create_cab_file().

◆ fci_write()

static UINT CDECL fci_write ( INT_PTR  hf,
void memory,
UINT  cb,
int err,
void pv 
)
static

Definition at line 2221 of file action.c.

2222 {
2223  HANDLE handle = (HANDLE)hf;
2224  DWORD dwWritten;
2225  BOOL res;
2226 
2227  res = WriteFile(handle, memory, cb, &dwWritten, NULL);
2228  ok(res, "Failed to WriteFile\n");
2229 
2230  return dwWritten;
2231 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
static char memory[1024 *256]
Definition: process.c:116
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
PVOID HANDLE
Definition: typedefs.h:71
static DWORD cb
Definition: integrity.c:41
#define ok(value,...)
Definition: atltest.h:57
GLuint res
Definition: glext.h:9613

Referenced by create_cab_file().

◆ file_exists()

static BOOL file_exists ( LPCSTR  file)
static

Definition at line 2692 of file action.c.

2693 {
2695 }
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:786
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
Definition: fci.c:126

Referenced by pf_exists().

◆ file_placed()

static int CDECL file_placed ( PCCAB  pccab,
char pszFile,
LONG  cbFile,
BOOL  fContinuation,
void pv 
)
static

Definition at line 2180 of file action.c.

2182 {
2183  return 0;
2184 }

Referenced by create_cab_file().

◆ get_date_str()

static void get_date_str ( LPSTR  date)
static

Definition at line 2859 of file action.c.

2860 {
2861  SYSTEMTIME systime;
2862 
2863  static const char date_fmt[] = "%d%02d%02d";
2864  GetLocalTime(&systime);
2865  sprintf(date, date_fmt, systime.wYear, systime.wMonth, systime.wDay);
2866 }
WORD wMonth
Definition: winbase.h:871
#define sprintf(buf, format,...)
Definition: sprintf.c:55
WORD wYear
Definition: winbase.h:870
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:276
WORD wDay
Definition: winbase.h:873
__u16 date
Definition: mkdosfs.c:366

Referenced by test_publish(), and test_register_product().

◆ get_next_cabinet()

static BOOL CDECL get_next_cabinet ( PCCAB  pccab,
ULONG  cbPrevCab,
void pv 
)
static

Definition at line 2169 of file action.c.

2170 {
2171  sprintf(pccab->szCab, pv, pccab->iCab);
2172  return TRUE;
2173 }
#define TRUE
Definition: types.h:120
int iCab
Definition: fci.h:151
#define sprintf(buf, format,...)
Definition: sprintf.c:55
char szCab[CB_MAX_CABINET_NAME]
Definition: fci.h:160

Referenced by add_file(), and create_cab_file().

◆ get_open_info()

static INT_PTR CDECL get_open_info ( char pszName,
USHORT pdate,
USHORT ptime,
USHORT pattribs,
int err,
void pv 
)
static

Definition at line 2371 of file action.c.

2373 {
2376  HANDLE handle;
2377  DWORD attrs;
2378  BOOL res;
2379 
2382 
2383  ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
2384 
2386  ok(res, "Expected GetFileInformationByHandle to succeed\n");
2387 
2389  FileTimeToDosDateTime(&filetime, pdate, ptime);
2390 
2391  attrs = GetFileAttributesA(pszName);
2392  ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
2393 
2394  return (INT_PTR)handle;
2395 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
int32_t INT_PTR
Definition: typedefs.h:62
BOOL WINAPI FileTimeToLocalFileTime(IN CONST FILETIME *lpFileTime, OUT LPFILETIME lpLocalFileTime)
Definition: time.c:211
#define FILE_SHARE_READ
Definition: compat.h:125
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:786
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:426
BOOL WINAPI GetFileInformationByHandle(HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation)
Definition: fileinfo.c:608
unsigned long DWORD
Definition: ntddk_ex.h:95
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define GENERIC_READ
Definition: compat.h:124
BOOL WINAPI FileTimeToDosDateTime(IN CONST FILETIME *lpFileTime, OUT LPWORD lpFatDate, OUT LPWORD lpFatTime)
Definition: time.c:37
#define FILE_FLAG_SEQUENTIAL_SCAN
Definition: disk.h:43
#define ok(value,...)
Definition: atltest.h:57
GLuint res
Definition: glext.h:9613
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399

Referenced by add_file().

◆ get_owner_company()

static void get_owner_company ( LPSTR owner,
LPSTR company 
)
static

Definition at line 3529 of file action.c.

3530 {
3531  LONG res;
3532  HKEY hkey;
3534 
3535  *owner = *company = NULL;
3536 
3537  if (is_wow64)
3539 
3541  "Software\\Microsoft\\MS Setup (ACME)\\User Info", &hkey);
3542  if (res == ERROR_SUCCESS)
3543  {
3544  *owner = reg_get_val_str(hkey, "DefName");
3545  *company = reg_get_val_str(hkey, "DefCompany");
3546  RegCloseKey(hkey);
3547  }
3548 
3549  if (!*owner || !*company)
3550  {
3552  "Software\\Microsoft\\Windows\\CurrentVersion", 0, access, &hkey);
3553  if (res == ERROR_SUCCESS)
3554  {
3555  *owner = reg_get_val_str(hkey, "RegisteredOwner");
3556  *company = reg_get_val_str(hkey, "RegisteredOrganization");
3557  RegCloseKey(hkey);
3558  }
3559  }
3560 
3561  if (!*owner || !*company)
3562  {
3564  "Software\\Microsoft\\Windows NT\\CurrentVersion", 0, access, &hkey);
3565  if (res == ERROR_SUCCESS)
3566  {
3567  *owner = reg_get_val_str(hkey, "RegisteredOwner");
3568  *company = reg_get_val_str(hkey, "RegisteredOrganization");
3569  RegCloseKey(hkey);
3570  }
3571  }
3572 }
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:3331
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
static STATEMGRSTATUS *static BOOL is_wow64
Definition: action.c:57
smooth NULL
Definition: ftsmooth.c:416
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
static LPSTR reg_get_val_str(HKEY hkey, LPCSTR name)
Definition: action.c:3511
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
GLuint res
Definition: glext.h:9613
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by test_register_user().

◆ get_system_dirs()

static BOOL get_system_dirs ( void  )
static

Definition at line 2476 of file action.c.

2477 {
2478  HKEY hkey;
2479  DWORD type, size;
2480 
2482  "Software\\Microsoft\\Windows\\CurrentVersion", &hkey))
2483  return FALSE;
2484 
2485  size = MAX_PATH;
2486  if (RegQueryValueExA(hkey, "ProgramFilesDir (x86)", 0, &type, (LPBYTE)PROG_FILES_DIR, &size) &&
2487  RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR, &size))
2488  {
2489  RegCloseKey(hkey);
2490  return FALSE;
2491  }
2492 
2493  size = MAX_PATH;
2494  if (RegQueryValueExA(hkey, "CommonFilesDir (x86)", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size) &&
2495  RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size))
2496  {
2497  RegCloseKey(hkey);
2498  return FALSE;
2499  }
2500 
2501  RegCloseKey(hkey);
2502 
2504  return FALSE;
2505 
2506  return TRUE;
2507 }
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:4023
#define TRUE
Definition: types.h:120
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
static CHAR PROG_FILES_DIR[MAX_PATH]
Definition: action.c:64
static CHAR COMMON_FILES_DIR[MAX_PATH]
Definition: action.c:65
GLsizeiptr size
Definition: glext.h:5919
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
static CHAR WINDOWS_DIR[MAX_PATH]
Definition: action.c:67
UINT WINAPI GetWindowsDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2336
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by START_TEST().

◆ get_temp_file()

static BOOL CDECL get_temp_file ( char pszTempName,
int  cbTempName,
void pv 
)
static

Definition at line 2352 of file action.c.

2353 {
2354  LPSTR tempname;
2355 
2356  tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
2357  GetTempFileNameA(".", "xx", 0, tempname);
2358 
2359  if (tempname && (strlen(tempname) < (unsigned)cbTempName))
2360  {
2361  lstrcpyA(pszTempName, tempname);
2362  HeapFree(GetProcessHeap(), 0, tempname);
2363  return TRUE;
2364  }
2365 
2366  HeapFree(GetProcessHeap(), 0, tempname);
2367 
2368  return FALSE;
2369 }
#define TRUE
Definition: types.h:120
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * LPSTR
Definition: xmlstorage.h:182
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define MAX_PATH
Definition: compat.h:26
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
Definition: filename.c:26
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by create_cab_file().

◆ get_user_dirs()

static BOOL get_user_dirs ( void  )
static

Definition at line 2456 of file action.c.

2457 {
2458  HKEY hkey;
2459  DWORD type, size;
2460 
2462  "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey))
2463  return FALSE;
2464 
2465  size = MAX_PATH;
2466  if (RegQueryValueExA(hkey, "AppData", 0, &type, (LPBYTE)APP_DATA_DIR, &size))
2467  {
2468  RegCloseKey(hkey);
2469  return FALSE;
2470  }
2471 
2472  RegCloseKey(hkey);
2473  return TRUE;
2474 }
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:4023
#define TRUE
Definition: types.h:120
#define HKEY_CURRENT_USER
Definition: winreg.h:11
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
GLsizeiptr size
Definition: glext.h:5919
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
static CHAR APP_DATA_DIR[MAX_PATH]
Definition: action.c:66

Referenced by START_TEST().

◆ get_user_sid()

static char* get_user_sid ( void  )
static

Definition at line 2328 of file action.c.

2329 {
2330  HANDLE token;
2331  DWORD size = 0;
2332  TOKEN_USER *user;
2333  char *usersid = NULL;
2334 
2335  if (!pConvertSidToStringSidA)
2336  {
2337  win_skip("ConvertSidToStringSidA is not available\n");
2338  return NULL;
2339  }
2342 
2343  user = HeapAlloc(GetProcessHeap(), 0, size);
2345  pConvertSidToStringSidA(user->User.Sid, &usersid);
2346  HeapFree(GetProcessHeap(), 0, user);
2347 
2348  CloseHandle(token);
2349  return usersid;
2350 }
#define CloseHandle
Definition: compat.h:398
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define TOKEN_QUERY
Definition: setypes.h:874
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1138
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:413
#define win_skip
Definition: test.h:141
void user(int argc, const char *argv[])
Definition: cmds.c:1350
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by test_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 2260 of file action.c.

2261 {
2262  HMODULE hmsi = GetModuleHandleA("msi.dll");
2263  HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
2264  HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
2265 
2266 #define GET_PROC(mod, func) \
2267  p ## func = (void*)GetProcAddress(mod, #func); \
2268  if(!p ## func) \
2269  trace("GetProcAddress(%s) failed\n", #func);
2270 
2276 
2277  GET_PROC(hadvapi32, CheckTokenMembership);
2278  GET_PROC(hadvapi32, ConvertSidToStringSidA);
2279  GET_PROC(hadvapi32, OpenProcessToken);
2280  GET_PROC(hadvapi32, RegDeleteKeyExA)
2282 
2283  hsrclient = LoadLibraryA("srclient.dll");
2286 
2287 #undef GET_PROC
2288 }
INSTALLSTATE WINAPI MsiGetComponentPathExA(LPCSTR product, LPCSTR comp, LPCSTR usersid, MSIINSTALLCONTEXT ctx, LPSTR buf, LPDWORD buflen)
Definition: msi.c:2916
LONG WINAPI RegDeleteKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ REGSAM samDesired, _In_ DWORD Reserved)
Definition: reg.c:1252
static HINSTANCE hkernel32
Definition: process.c:66
BOOL WINAPI CheckTokenMembership(IN HANDLE ExistingTokenHandle, IN PSID SidToCheck, OUT PBOOL IsMember)
Definition: token.c:21
UINT WINAPI MsiSourceListEnumSourcesA(LPCSTR szProductCodeOrPatch, LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwIndex, LPSTR szSource, LPDWORD pcchSource)
Definition: source.c:339
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:1974
#define GET_PROC(mod, func)
static HMODULE hsrclient
Definition: action.c:55
UINT WINAPI MsiQueryFeatureStateExA(LPCSTR product, LPCSTR usersid, MSIINSTALLCONTEXT ctx, LPCSTR feature, INSTALLSTATE *state)
Definition: msi.c:3043
BOOL WINAPI ConvertSidToStringSidA(PSID Sid, LPSTR *StringSid)
Definition: security.c:3313
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
BOOL WINAPI SRSetRestorePointA(PRESTOREPOINTINFOA pRestorePtSpec, PSTATEMGRSTATUS pSMgrStatus)
Definition: sfc.c:54
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
UINT WINAPI MsiSourceListGetInfoA(LPCSTR szProduct, LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, LPCSTR szProperty, LPSTR szValue, LPDWORD pcchValue)
Definition: source.c:485
UINT WINAPI MsiQueryComponentStateA(LPCSTR szProductCode, LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext, LPCSTR szComponent, INSTALLSTATE *pdwState)
Definition: msi.c:2081

Referenced by START_TEST().

◆ INSTALLSTATE()

static INSTALLSTATE ( WINAPI pMsiGetComponentPathExA)
static

◆ is_process_limited()

static BOOL is_process_limited ( void  )
static

Definition at line 2290 of file action.c.

2291 {
2293  PSID Group = NULL;
2294  BOOL IsInGroup;
2295  HANDLE token;
2296 
2297  if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE;
2298 
2300  DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
2301  !pCheckTokenMembership(NULL, Group, &IsInGroup))
2302  {
2303  trace("Could not check if the current user is an administrator\n");
2304  FreeSid(Group);
2305  return FALSE;
2306  }
2307  FreeSid(Group);
2308 
2309  if (!IsInGroup)
2310  {
2311  /* Only administrators have enough privileges for these tests */
2312  return TRUE;
2313  }
2314 
2315  if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
2316  {
2317  BOOL ret;
2319  DWORD size;
2320 
2322  CloseHandle(token);
2323  return (ret && type == TokenElevationTypeLimited);
2324  }
2325  return FALSE;
2326 }
enum _TOKEN_ELEVATION_TYPE TOKEN_ELEVATION_TYPE
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
_In_opt_ PSID Group
Definition: rtlfuncs.h:1606
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
unsigned int BOOL
Definition: ntddk_ex.h:94
PVOID WINAPI FreeSid(PSID pSid)
Definition: security.c:577
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210
smooth NULL
Definition: ftsmooth.c:416
#define SECURITY_NT_AUTHORITY
Definition: setypes.h:526
GLsizeiptr size
Definition: glext.h:5919
#define trace
Definition: atltest.h:70
#define SECURITY_BUILTIN_DOMAIN_RID
Definition: setypes.h:553
#define TOKEN_QUERY
Definition: setypes.h:874
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1138
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:413
#define DOMAIN_ALIAS_RID_ADMINS
Definition: setypes.h:624
SID_IDENTIFIER_AUTHORITY NtAuthority
Definition: database.c:19
BOOL WINAPI AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount, DWORD nSubAuthority0, DWORD nSubAuthority1, DWORD nSubAuthority2, DWORD nSubAuthority3, DWORD nSubAuthority4, DWORD nSubAuthority5, DWORD nSubAuthority6, DWORD nSubAuthority7, PSID *pSid)
Definition: security.c:553

Referenced by test_create_remove_folder(), test_create_remove_shortcut(), test_delete_services(), test_duplicate_files(), test_envvar(), test_find_related_products(), test_install_remove_odbc(), test_install_services(), test_move_files(), test_process_components(), test_publish(), test_publish_assemblies(), test_publish_components(), test_publish_features(), test_publish_product(), test_publish_sourcelist(), test_register_class_info(), test_register_extension_info(), test_register_font(), test_register_mime_info(), test_register_product(), test_register_progid_info(), test_register_typelib(), test_register_user(), test_remove_duplicate_files(), test_remove_env_strings(), test_remove_existing_products(), test_remove_files(), test_remove_ini_values(), test_remove_registry_values(), test_self_registration(), test_validate_product_id(), and test_write_registry_values().

◆ LONG()

static LONG ( WINAPI pRegDeleteKeyExA)
static

◆ mem_alloc()

static void* CDECL mem_alloc ( ULONG  cb)
static

Definition at line 2159 of file action.c.

2160 {
2161  return HeapAlloc(GetProcessHeap(), 0, cb);
2162 }
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static DWORD cb
Definition: integrity.c:41

Referenced by create_cab_file().

◆ mem_free()

static void CDECL mem_free ( void memory)
static

Definition at line 2164 of file action.c.

2165 {
2167 }
static char memory[1024 *256]
Definition: process.c:116
#define GetProcessHeap()
Definition: compat.h:395
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by create_cab_file().

◆ notify_system_change()

static BOOL notify_system_change ( DWORD  event_type,
STATEMGRSTATUS status 
)
static

Definition at line 2664 of file action.c.

2665 {
2666  RESTOREPOINTINFOA spec;
2667 
2668  spec.dwEventType = event_type;
2670  spec.llSequenceNumber = status->llSequenceNumber;
2671  lstrcpyA(spec.szDescription, "msitest restore point");
2672 
2673  return pSRSetRestorePointA(&spec, status);
2674 }
#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().

◆ pf_exists()

static BOOL pf_exists ( LPCSTR  file)
static

Definition at line 2697 of file action.c.

2698 {
2699  CHAR path[MAX_PATH];
2700 
2702  lstrcatA(path, "\\");
2703  lstrcatA(path, file);
2704 
2705  return file_exists(path);
2706 }
char CHAR
Definition: xmlstorage.h:175
static CHAR PROG_FILES_DIR[MAX_PATH]
Definition: action.c:64
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
static BOOL file_exists(LPCSTR file)
Definition: action.c:2692
#define MAX_PATH
Definition: compat.h:26
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
Definition: services.c:325
Definition: fci.c:126

Referenced by test_create_remove_folder(), test_create_remove_shortcut(), test_install_remove_odbc(), test_publish(), test_publish_sourcelist(), test_remove_duplicate_files(), and test_remove_files().

◆ progress()

static LONG CDECL progress ( UINT  typeStatus,
ULONG  cb1,
ULONG  cb2,
void pv 
)
static

Definition at line 2175 of file action.c.

2176 {
2177  return 0;
2178 }

Referenced by add_file(), and create_cab_file().

◆ reg_get_val_str()

static LPSTR reg_get_val_str ( HKEY  hkey,
LPCSTR  name 
)
static

Definition at line 3511 of file action.c.

3512 {
3513  DWORD len = 0;
3514  LPSTR val;
3515  LONG r;
3516 
3517  r = RegQueryValueExA(hkey, name, NULL, NULL, NULL, &len);
3518  if (r != ERROR_SUCCESS)
3519  return NULL;
3520 
3521  len += sizeof (WCHAR);
3522  val = HeapAlloc(GetProcessHeap(), 0, len);
3523  if (!val) return NULL;
3524  val[0] = 0;
3525  RegQueryValueExA(hkey, name, NULL, NULL, (LPBYTE)val, &len);
3526  return val;
3527 }
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:4023
#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:52
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
GLuint GLfloat * val
Definition: glext.h:7180
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
Definition: name.c:36

Referenced by get_owner_company().

◆ remove_restore_point()

static void remove_restore_point ( DWORD  seq_number)
static

Definition at line 2676 of file action.c.

2677 {
2678  DWORD res;
2679 
2680  res = pSRRemoveRestorePoint(seq_number);
2681  if (res != ERROR_SUCCESS)
2682  trace("Failed to remove the restore point : %08x\n", res);
2683 }
#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().

◆ set_cab_parameters()

static void set_cab_parameters ( PCCAB  pCabParams,
const CHAR name,
DWORD  max_size 
)
static

Definition at line 2412 of file action.c.

2413 {
2414  ZeroMemory(pCabParams, sizeof(CCAB));
2415 
2416  pCabParams->cb = max_size;
2417  pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
2418  pCabParams->setID = 0xbeef;
2419  pCabParams->iCab = 1;
2420  lstrcpyA(pCabParams->szCabPath, CURR_DIR);
2421  lstrcatA(pCabParams->szCabPath, "\\");
2422  lstrcpyA(pCabParams->szCab, name);
2423 }
static CHAR CURR_DIR[MAX_PATH]
Definition: action.c:63
ULONG cbFolderThresh
Definition: fci.h:146
#define FOLDER_THRESHOLD
Definition: action.c:2155
#define ZeroMemory
Definition: winbase.h:1635
Definition: fci.h:144
int iCab
Definition: fci.h:151
char szCab[CB_MAX_CABINET_NAME]
Definition: fci.h:160
static INT max_size
Definition: history.c:51
ULONG cb
Definition: fci.h:145
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
USHORT setID
Definition: fci.h:157
Definition: name.c:36
char szCabPath[CB_MAX_CAB_PATH]
Definition: fci.h:161

Referenced by create_cab_file().

◆ START_TEST()

START_TEST ( action  )

Definition at line 7009 of file action.c.

7010 {
7011  DWORD len;
7012  char temp_path[MAX_PATH], prev_path[MAX_PATH], log_file[MAX_PATH];
7014  BOOL ret = FALSE;
7015 
7017 
7018  if (pIsWow64Process)
7019  pIsWow64Process(GetCurrentProcess(), &is_wow64);
7020 
7021  GetCurrentDirectoryA(MAX_PATH, prev_path);
7024 
7026  len = lstrlenA(CURR_DIR);
7027 
7028  if(len && (CURR_DIR[len - 1] == '\\'))
7029  CURR_DIR[len - 1] = 0;
7030 
7031  ok(get_system_dirs(), "failed to retrieve system dirs\n");
7032  ok(get_user_dirs(), "failed to retrieve user dirs\n");
7033 
7034  /* Create a restore point ourselves so we circumvent the multitude of restore points
7035  * that would have been created by all the installation and removal tests.
7036  *
7037  * This is not needed on version 5.0 where setting MSIFASTINSTALL prevents the
7038  * creation of restore points.
7039  */
7040  if (pSRSetRestorePointA && !pMsiGetComponentPathExA)
7041  {
7042  memset(&status, 0, sizeof(status));
7044  }
7045 
7046  /* Create only one log file and don't append. We have to pass something
7047  * for the log mode for this to work. The logfile needs to have an absolute
7048  * path otherwise we still end up with some extra logfiles as some tests
7049  * change the current directory.
7050  */
7052  lstrcatA(log_file, "\\msitest.log");
7054 
7060  test_publish();
7063  test_move_files();
7066  test_envvar();
7089 
7091 
7092  if (pSRSetRestorePointA && !pMsiGetComponentPathExA && ret)
7093  {
7095  if (ret)
7096  remove_restore_point(status.llSequenceNumber);
7097  }
7099 
7100  SetCurrentDirectoryA(prev_path);
7101 }
static CHAR CURR_DIR[MAX_PATH]
Definition: action.c:63
static void test_delete_services(void)
Definition: action.c:5475
static void test_register_font(void)
Definition: action.c:5668
static void test_remove_env_strings(void)
Definition: action.c:6276
static void test_remove_existing_products(void)
Definition: action.c:6973
static void test_publish_sourcelist(void)
Definition: action.c:4411
static void test_register_mime_info(void)
Definition: action.c:6715
static void test_find_related_products(void)
Definition: action.c:6170
static void test_publish_features(void)
Definition: action.c:3386
UNICODE_STRING log_file
Definition: btrfs.c:91
static BOOL get_user_dirs(void)
Definition: action.c:2456
static void test_install_remove_odbc(void)
Definition: action.c:5775
static void test_validate_product_id(void)
Definition: action.c:5724
static void test_create_remove_shortcut(void)
Definition: action.c:5868
static void test_register_class_info(void)
Definition: action.c:6472
static void test_duplicate_files(void)
Definition: action.c:4915
static void test_process_components(void)
Definition: action.c:3671
static void test_register_typelib(void)
Definition: action.c:5829
#define END_NESTED_SYSTEM_CHANGE
unsigned int BOOL
Definition: ntddk_ex.h:94
static void test_self_registration(void)
Definition: action.c:5626
static STATEMGRSTATUS *static BOOL is_wow64
Definition: action.c:57
static void test_install_services(void)
Definition: action.c:5547
static void test_remove_files(void)
Definition: action.c:4634
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
static void test_start_stop_services(void)
Definition: action.c:5358
static void test_write_registry_values(void)
Definition: action.c:4954
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
static void test_register_extension_info(void)
Definition: action.c:6537
#define BEGIN_NESTED_SYSTEM_CHANGE
#define FreeLibrary(x)
Definition: compat.h:405
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1138
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
static BOOL get_system_dirs(void)
Definition: action.c:2476
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
static HMODULE hsrclient
Definition: action.c:55
static void test_publish(void)
Definition: action.c:3806
int ret
static void test_remove_duplicate_files(void)
Definition: action.c:6001
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:3145
static void test_publish_assemblies(void)
Definition: action.c:6760
static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
Definition: action.c:2664
static void test_envvar(void)
Definition: action.c:5161
static void test_register_user(void)
Definition: action.c:3574
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:5908
#define ok(value,...)
Definition: atltest.h:57
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2145
static void test_register_progid_info(void)
Definition: action.c:6589
static void test_register_product(void)
Definition: action.c:2868
static void test_remove_ini_values(void)
Definition: action.c:6210
static void test_move_files(void)
Definition: action.c:4768
static void init_functionpointers(void)
Definition: action.c:2260
static void test_remove_registry_values(void)
Definition: action.c:6051
#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:2676
static void test_create_remove_folder(void)
Definition: action.c:5305
UINT WINAPI MsiEnableLogA(DWORD dwLogMode, LPCSTR szLogFile, DWORD attributes)
Definition: msi.c:1908
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 5305 of file action.c.

5306 {
5307  UINT r;
5308 
5309  if (is_process_limited())
5310  {
5311  skip("process is limited\n");
5312  return;
5313  }
5314 
5315  CreateDirectoryA("msitest", NULL);
5316  CreateDirectoryA("msitest\\first", NULL);
5317  CreateDirectoryA("msitest\\second", NULL);
5318  create_file("msitest\\first\\one.txt", 1000);
5319  create_file("msitest\\second\\two.txt", 1000);
5320  create_database(msifile, cf_tables, sizeof(cf_tables) / sizeof(msi_table));
5321 
5323 
5326  {
5327  skip("Not enough rights to perform tests\n");
5328  goto error;
5329  }
5330  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5331 
5332  ok(pf_exists("msitest\\first\\one.txt"), "file not installed\n");
5333  ok(pf_exists("msitest\\first"), "directory not created\n");
5334  ok(pf_exists("msitest\\second\\two.txt"), "file not installed\n");
5335  ok(pf_exists("msitest\\second"), "directory not created\n");
5336  ok(pf_exists("msitest\\third"), "directory not created\n");
5337  ok(pf_exists("msitest"), "directory not created\n");
5338 
5339  r = MsiInstallProductA(msifile, "REMOVE=ALL");
5340  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5341 
5342  ok(!pf_exists("msitest\\first\\one.txt"), "file not removed\n");
5343  ok(!pf_exists("msitest\\first"), "directory not removed\n");
5344  ok(!pf_exists("msitest\\second\\two.txt"), "file not removed\n");
5345  ok(!pf_exists("msitest\\second"), "directory not removed\n");
5346  ok(!pf_exists("msitest\\third"), "directory not removed\n");
5347  todo_wine ok(!pf_exists("msitest"), "directory not removed\n");
5348 
5349 error:
5350  DeleteFileA("msitest\\first\\one.txt");
5351  DeleteFileA("msitest\\second\\two.txt");
5352  RemoveDirectoryA("msitest\\first");
5353  RemoveDirectoryA("msitest\\second");
5354  RemoveDirectoryA("msitest");
5356 }
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define ERROR_SUCCESS
Definition: deptool.c:10
#define error(str)
Definition: mkdosfs.c:1605
#define create_file(name, size)
Definition: action.c:2529
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:205
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static const msi_table cf_tables[]
Definition: action.c:1780
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2313
static BOOL is_process_limited(void)
Definition: action.c:2290
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define todo_wine
Definition: test.h:154
static BOOL pf_exists(LPCSTR file)
Definition: action.c:2697
#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 create_database(name, tables, num_tables)
Definition: action.c:2620
#define skip(...)
Definition: atltest.h:64
static const char * msifile
Definition: action.c:62

Referenced by START_TEST().

◆ test_create_remove_shortcut()

static void test_create_remove_shortcut ( void  )
static

Definition at line 5868 of file action.c.

5869 {
5870  UINT r;
5871 
5872  if (is_process_limited())
5873  {
5874  skip("process is limited\n");
5875  return;
5876  }
5877 
5879  create_file("msitest\\target.txt", 1000);
5880  create_database(msifile, crs_tables, sizeof(crs_tables) / sizeof(msi_table));
5881 
5883 
5886  {
5887  skip("Not enough rights to perform tests\n");
5888  goto error;
5889  }
5890  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5891 
5892  ok(pf_exists("msitest\\target.txt"), "file not created\n");
5893  ok(pf_exists("msitest\\shortcut.lnk"), "file not created\n");
5894 
5895  r = MsiInstallProductA(msifile, "REMOVE=ALL");
5896  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5897 
5898  ok(!delete_pf("msitest\\shortcut.lnk", TRUE), "file not removed\n");
5899  ok(!delete_pf("msitest\\target.txt", TRUE), "file not removed\n");
5900  todo_wine ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5901 
5902 error:
5903  DeleteFileA("msitest\\target.txt");
5906 }
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define error(str)
Definition: mkdosfs.c:1605
#define create_file(name, size)
Definition: action.c:2529
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:205
static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
Definition: action.c:2552
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2313
static void create_test_files(void)
Definition: action.c:2531
static BOOL is_process_limited(void)
Definition: action.c:2290
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define todo_wine
Definition: test.h:154
static BOOL pf_exists(LPCSTR file)
Definition: action.c:2697
#define ok(value,...)
Definition: atltest.h:57
static const msi_table crs_tables[]
Definition: action.c:1900
unsigned int UINT
Definition: ndis.h:50
static void delete_test_files(void)
Definition: action.c:2566
#define create_database(name, tables, num_tables)
Definition: action.c:2620
#define skip(...)
Definition: atltest.h:64
static const char * msifile
Definition: action.c:62

Referenced by START_TEST().

◆ test_delete_services()

static void test_delete_services ( void  )
static

Definition at line 5475 of file action.c.

5476 {
5477  UINT r;
5478  SC_HANDLE manager, service;
5479  DWORD error;
5480 
5481  if (is_process_limited())
5482  {
5483  skip("process is limited\n");
5484  return;
5485  }
5486 
5488  ok(manager != NULL, "can't open service manager %u\n", GetLastError());
5489  if (!manager) return;
5490 
5491  service = CreateServiceA(manager, "TestService3", "TestService3",
5493  SERVICE_ERROR_NORMAL, "C:\\doesnt_exist.exe", NULL, NULL, NULL, NULL, NULL);
5494  ok(service != NULL, "can't create service %u\n", GetLastError());
5495  CloseServiceHandle(service);
5496  CloseServiceHandle(manager);
5497  if (!service) return;
5498 
5500  create_database(msifile, sds_tables, sizeof(sds_tables) / sizeof(msi_table));
5501 
5503 
5506  {
5507  skip("Not enough rights to perform tests\n");
5508  goto error;
5509  }
5510  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5511 
5513  ok(manager != NULL, "can't open service manager\n");
5514  if (!manager) goto error;
5515 
5516  service = OpenServiceA(manager, "TestService3", GENERIC_ALL);
5517  error = GetLastError();
5518  ok(service == NULL, "TestService3 not deleted\n");
5519  ok(error == ERROR_SERVICE_DOES_NOT_EXIST, "wrong error %u\n", error);
5520  CloseServiceHandle(manager);
5521 
5522  r = MsiInstallProductA(msifile, "REMOVE=ALL");
5523  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5524 
5525  ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5526  ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5527  ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5528  ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5529  ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5530  ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5531  ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5532  ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5533  ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5534  ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5535  ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5536  ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5537  ok(delete_pf("msitest", FALSE), "Directory not created\n");
5538 
5539 error:
5540  delete_test_service("TestService");
5541  delete_test_service("TestService2");
5542  delete_test_service("TestService3");
5545 }
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define GENERIC_ALL
Definition: nt_native.h:92
#define SERVICE_ERROR_NORMAL
Definition: cmtypes.h:980
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define error(str)
Definition: mkdosfs.c:1605
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:205
static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
Definition: action.c:2552
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2313
#define SERVICE_ALL_ACCESS
Definition: winsvc.h:62
static void create_test_files(void)
Definition: action.c:2531
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:677
static BOOL is_process_limited(void)
Definition: action.c:2290
SC_HANDLE WINAPI OpenSCManagerA(LPCSTR lpMachineName, LPCSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:1967
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:577
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define SERVICE_WIN32_OWN_PROCESS
Definition: cmtypes.h:960
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
static void delete_test_files(void)
Definition: action.c:2566
#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:2055
#define create_database(name, tables, num_tables)
Definition: action.c:2620
#define skip(...)
Definition: atltest.h:64
static const msi_table sds_tables[]
Definition: action.c:1806
#define SERVICE_DEMAND_START
Definition: cmtypes.h:976
static const char * msifile
Definition: action.c:62
static void delete_test_service(const char *name)
Definition: action.c:5456

Referenced by START_TEST().

◆ test_duplicate_files()

static void test_duplicate_files ( void  )
static

Definition at line 4915 of file action.c.

4916 {
4917  UINT r;
4918 
4919  if (is_process_limited())
4920  {
4921  skip("process is limited\n");
4922  return;
4923  }
4924 
4925  CreateDirectoryA("msitest", NULL);
4926  create_file("msitest\\maximus", 500);
4927  create_database(msifile, df_tables, sizeof(df_tables) / sizeof(msi_table));
4928 
4930 
4931  /* fails if the destination folder is not a valid property */
4932 
4935  {
4936  skip("Not enough rights to perform tests\n");
4937  goto error;
4938  }
4939  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4940  ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4941  ok(delete_pf("msitest\\augustus", TRUE), "File not duplicated\n");
4942  ok(delete_pf("msitest\\this\\doesnot\\exist\\maximus", TRUE), "File not duplicated\n");
4943  ok(delete_pf("msitest\\this\\doesnot\\exist", FALSE), "Directory not created\n");
4944  ok(delete_pf("msitest\\this\\doesnot", FALSE), "Directory not created\n");
4945  ok(delete_pf("msitest\\this", FALSE), "Directory not created\n");
4946  ok(delete_pf("msitest", FALSE), "Directory not created\n");
4947 
4948 error:
4949  DeleteFileA("msitest\\maximus");
4950  RemoveDirectoryA("msitest");
4952 }
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define error(str)
Definition: mkdosfs.c:1605
#define create_file(name, size)
Definition: action.c:2529
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:205
static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
Definition: action.c:2552
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static const msi_table df_tables[]
Definition: action.c:1754
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2313
static BOOL is_process_limited(void)
Definition: action.c:2290
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c: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 create_database(name, tables, num_tables)
Definition: action.c:2620
#define skip(...)
Definition: atltest.h:64
static const char * msifile
Definition: action.c:62

Referenced by START_TEST().

◆ test_envvar()

static void test_envvar ( void  )
static

Definition at line 5161 of file action.c.

5162 {
5163  static const char *results[] =
5164  {
5165  "1;2", /* MSITESTVAR11 */
5166  "1", /* MSITESTVAR12 */
5167  "1;2", /* MSITESTVAR13 */
5168  ";1;", /* MSITESTVAR14 */
5169  ";;1;;", /* MSITESTVAR15 */
5170  " 1 ", /* MSITESTVAR16 */
5171  ";;2;;1", /* MSITESTVAR17 */
5172  "1;;2;;", /* MSITESTVAR18 */
5173  "1", /* MSITESTVAR19 */
5174  "1", /* MSITESTVAR20 */
5175  "1", /* MSITESTVAR21 */
5176  NULL
5177  };
5178  UINT r;
5179  HKEY env;
5180  LONG res;
5181  DWORD type, size;
5182  char buffer[16];
5183  UINT i;
5184 
5185  if (is_process_limited())
5186  {
5187  skip("process is limited\n");
5188  return;
5189  }
5190 
5192  create_database(msifile, env_tables, sizeof(env_tables) / sizeof(msi_table));
5193 
5194  res = RegCreateKeyExA(HKEY_CURRENT_USER, "Environment", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &env, NULL);
5195  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5196 
5197  res = RegSetValueExA(env, "MSITESTVAR1", 0, REG_SZ, (const BYTE *)"0", 2);
5198  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5199 
5200  res = RegSetValueExA(env, "MSITESTVAR2", 0, REG_SZ, (const BYTE *)"0", 2);
5201  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5202 
5203  res = RegSetValueExA(env, "MSITESTVAR21", 0, REG_SZ, (const BYTE *)"1", 2);
5204  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5205 
5207 
5210  {
5211  skip("Not enough rights to perform tests\n");
5212  goto error;
5213  }
5214  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5215 
5216  type = REG_NONE;
5217  size = sizeof(buffer);
5218  buffer[0] = 0;
5219  res = RegQueryValueExA(env, "MSITESTVAR1", NULL, &type, (LPBYTE)buffer, &size);
5220  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5221  ok(type == REG_SZ, "Expected REG_SZ, got %u\n", type);
5222  ok(!lstrcmpA(buffer, "1"), "Expected \"1\", got %s\n", buffer);
5223 
5224  res = RegDeleteValueA(env, "MSITESTVAR1");
5225  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5226 
5227  type = REG_NONE;
5228  size = sizeof(buffer);
5229  buffer[0] = 0;
5230  res = RegQueryValueExA(env, "MSITESTVAR2", NULL, &type, (LPBYTE)buffer, &size);
5231  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5232  ok(type == REG_SZ, "Expected REG_SZ, got %u\n", type);
5233  ok(!lstrcmpA(buffer, "1"), "Expected \"1\", got %s\n", buffer);
5234 
5235  res = RegDeleteValueA(env, "MSITESTVAR2");
5236  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5237 
5238  res = RegDeleteValueA(env, "MSITESTVAR3");
5239  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5240 
5241  res = RegDeleteValueA(env, "MSITESTVAR4");
5242  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5243 
5244  res = RegDeleteValueA(env, "MSITESTVAR5");
5245  ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5246 
5247  res = RegDeleteValueA(env, "MSITESTVAR6");
5248  ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5249 
5250  res = RegDeleteValueA(env, "MSITESTVAR7");
5251  ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5252 
5253  res = RegDeleteValueA(env, "MSITESTVAR8");
5254  ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5255 
5256  res = RegDeleteValueA(env, "MSITESTVAR9");
5257  ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5258 
5259  res = RegDeleteValueA(env, "MSITESTVAR10");
5260  ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5261 
5262  i = 11;
5263  while (results[i - 11])
5264  {
5265  char name[20];
5266  sprintf(name, "MSITESTVAR%d", i);
5267 
5268  type = REG_NONE;
5269  size = sizeof(buffer);
5270  buffer[0] = 0;
5272  ok(res == ERROR_SUCCESS, "%d: Expected ERROR_SUCCESS, got %d\n", i, res);
5273  ok(type == REG_SZ, "%d: Expected REG_SZ, got %u\n", i, type);
5274  ok(!lstrcmpA(buffer, results[i - 11]), "%d: Expected %s, got %s\n", i, results[i - 11], buffer);
5275 
5277  ok(res == ERROR_SUCCESS, "%d: Expected ERROR_SUCCESS, got %d\n", i, res);
5278  i++;
5279  }
5280 
5281  delete_pf("msitest\\cabout\\new\\five.txt", TRUE);
5282  delete_pf("msitest\\cabout\\new", FALSE);
5283  delete_pf("msitest\\cabout\\four.txt", TRUE);
5284  delete_pf("msitest\\cabout", FALSE);
5285  delete_pf("msitest\\changed\\three.txt", TRUE);
5286  delete_pf("msitest\\changed", FALSE);
5287  delete_pf("msitest\\first\\two.txt", TRUE);
5288  delete_pf("msitest\\first", FALSE);
5289  delete_pf("msitest\\filename", TRUE);
5290  delete_pf("msitest\\one.txt", TRUE);
5291  delete_pf("msitest\\service.exe", TRUE);
5292  delete_pf("msitest\\service2.exe", TRUE);
5293  delete_pf("msitest", FALSE);
5294 
5295 error:
5296  RegDeleteValueA(env, "MSITESTVAR1");
5297  RegDeleteValueA(env, "MSITESTVAR2");
5298  RegDeleteValueA(env, "MSITESTVAR21");
5299  RegCloseKey(env);
5300 
5303 }
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:4023
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define error(str)
Definition: mkdosfs.c:1605
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:205
static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
Definition: action.c:2552
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define HKEY_CURRENT_USER
Definition: winreg.h:11
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
GLuint buffer
Definition: glext.h:5915
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2313
static void create_test_files(void)
Definition: action.c:2531
#define sprintf(buf, format,...)
Definition: sprintf.c:55
static BOOL is_process_limited(void)
Definition: action.c:2290
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
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
GLsizeiptr size
Definition: glext.h:5919
static const msi_table env_tables[]
Definition: action.c:1691
unsigned long DWORD
Definition: ntddk_ex.h:95
struct _test_info results[8]
Definition: SetCursorPos.c:29
unsigned char BYTE
Definition: mem.h:68
#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
unsigned int UINT
Definition: ndis.h:50
static void delete_test_files(void)
Definition: action.c:2566
static LPCWSTR LPCWSTR LPCWSTR env
Definition: db.cpp:168
#define create_database(name, tables, num_tables)
Definition: action.c:2620
#define skip(...)
Definition: atltest.h:64
Definition: name.c:36
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:4812
#define REG_NONE
Definition: nt_native.h:1492
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 const char * msifile
Definition: action.c:62
#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 6170 of file action.c.

6171 {
6172  UINT r;
6173 
6174  if (is_process_limited())
6175  {
6176  skip("process is limited\n");
6177  return;
6178  }
6179 
6181  create_file("msitest\\product.txt", 1000);
6182  create_database(msifile, frp_tables, sizeof(frp_tables) / sizeof(msi_table));
6183 
6185 
6188  {
6189  skip("Not enough rights to perform tests\n");
6190  goto error;
6191  }
6192  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6193 
6194  /* install again, so it finds the upgrade code */
6196  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6197 
6198  r = MsiInstallProductA(msifile, "REMOVE=ALL");
6199  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6200 
6201  ok(!delete_pf("msitest\\product.txt", TRUE), "file not removed\n");
6202  ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6203 
6204 error:
6205  DeleteFileA("msitest\\product.txt");
6208 }
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define error(str)
Definition: mkdosfs.c:1605
#define create_file(name, size)
Definition: action.c:2529
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:205
static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
Definition: action.c:2552
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2313
static void create_test_files(void)
Definition: action.c:2531
static BOOL is_process_limited(void)
Definition: action.c:2290
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
static void delete_test_files(void)
Definition: action.c:2566
#define create_database(name, tables, num_tables)
Definition: action.c:2620
#define skip(...)
Definition: atltest.h:64
static const msi_table frp_tables[]
Definition: action.c:1953
static const char * msifile
Definition: action.c:62

Referenced by START_TEST().

◆ test_install_remove_odbc()

static void test_install_remove_odbc ( void  )
static

Definition at line 5775 of file action.c.

5776 {
5777  UINT r;
5778 
5779  if (is_process_limited())
5780  {
5781  skip("process is limited\n");
5782  return;
5783  }
5784 
5786  create_file("msitest\\ODBCdriver.dll", 1000);
5787  create_file("msitest\\ODBCdriver2.dll", 1000);
5788  create_file("msitest\\ODBCtranslator.dll", 1000);
5789  create_file("msitest\\ODBCtranslator2.dll", 1000);
5790  create_file("msitest\\ODBCsetup.dll", 1000);
5792 
5794 
5797  {
5798  skip("Not enough rights to perform tests\n");
5799  goto error;
5800  }
5801  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5802 
5803  ok(pf_exists("msitest\\ODBCdriver.dll"), "file not created\n");
5804  ok(pf_exists("msitest\\ODBCdriver2.dll"), "file not created\n");
5805  ok(pf_exists("msitest\\ODBCtranslator.dll"), "file not created\n");
5806  ok(pf_exists("msitest\\ODBCtranslator2.dll"), "file not created\n");
5807  ok(pf_exists("msitest\\ODBCsetup.dll"), "file not created\n");
5808 
5809  r = MsiInstallProductA(msifile, "REMOVE=ALL");
5810  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5811 
5812  ok(!delete_pf("msitest\\ODBCdriver.dll", TRUE), "file not removed\n");
5813  ok(!delete_pf("msitest\\ODBCdriver2.dll", TRUE), "file not removed\n");
5814  ok(!delete_pf("msitest\\ODBCtranslator.dll", TRUE), "file not removed\n");
5815  ok(!delete_pf("msitest\\ODBCtranslator2.dll", TRUE), "file not removed\n");
5816  ok(!delete_pf("msitest\\ODBCsetup.dll", TRUE), "file not removed\n");
5817  ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5818 
5819 error:
5820  DeleteFileA("msitest\\ODBCdriver.dll");
5821  DeleteFileA("msitest\\ODBCdriver2.dll");
5822  DeleteFileA("msitest\\ODBCtranslator.dll");
5823  DeleteFileA("msitest\\ODBCtranslator2.dll");
5824  DeleteFileA("msitest\\ODBCsetup.dll");
5827 }
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define error(str)
Definition: mkdosfs.c:1605
#define create_file(name, size)
Definition: action.c:2529
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:205
static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
Definition: action.c:2552
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2313
static void create_test_files(void)
Definition: action.c:2531
static BOOL is_process_limited(void)
Definition: action.c:2290
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
static BOOL pf_exists(LPCSTR file)
Definition: action.c:2697
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
static void delete_test_files(void)
Definition: action.c:2566
static const msi_table odbc_tables[]
Definition: action.c:1872
#define create_database(name, tables, num_tables)
Definition: action.c:2620
#define skip(...)
Definition: atltest.h:64
static const char * msifile
Definition: action.c:62

Referenced by START_TEST().

◆ test_install_services()

static void test_install_services ( void  )
static

Definition at line 5547 of file action.c.

5548 {
5549  UINT r;
5550  SC_HANDLE manager, service;
5551  LONG res;
5552  HKEY hKey;
5553  DWORD err_control, err_controlsize, err_controltype;
5554