ReactOS  r76032
install.c File Reference
#include <stdio.h>
#include <windows.h>
#include <msiquery.h>
#include <msidefs.h>
#include <msi.h>
#include <fci.h>
#include <objidl.h>
#include <srrestoreptapi.h>
#include <shlobj.h>
#include "wine/test.h"
Include dependency graph for install.c:

Go to the source code of this file.

Classes

struct  _msi_table
 
struct  sourcepathmap
 

Macros

#define _WIN32_MSI   300
 
#define COBJMACROS
 
#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)
 
#define create_database_template(name, tables, num_tables, version, template)
 
#define NUM_TRANSFORM_TABLES   (sizeof table_transform_data/sizeof table_transform_data[0])
 
#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 BOOL (WINAPI *pCheckTokenMembership)(HANDLE
 
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY
 
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 BOOL check_record (MSIHANDLE rec, UINT field, LPCSTR val)
 
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 BOOL delete_pf_native (const CHAR *rel_path, BOOL is_file)
 
static BOOL delete_cf (const CHAR *rel_path, BOOL is_file)
 
static BOOL compare_pf_data (const char *filename, const char *data, DWORD size)
 
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, const char *packagecode)
 
static void create_database_wordcount (const CHAR *name, const msi_table *tables, int num_tables, INT version, INT wordcount, const char *template, const char *packagecode)
 
static void check_service_is_installed (void)
 
static BOOL notify_system_change (DWORD event_type, STATEMGRSTATUS *status)
 
static void remove_restore_point (DWORD seq_number)
 
static LONG delete_key (HKEY key, LPCSTR subkey, REGSAM access)
 
static void test_MsiInstallProduct (void)
 
static void test_MsiSetComponentState (void)
 
static void test_packagecoltypes (void)
 
static void create_cc_test_files (void)
 
static void delete_cab_files (void)
 
static void test_continuouscabs (void)
 
static void test_caborder (void)
 
static void test_mixedmedia (void)
 
static void test_samesequence (void)
 
static void test_uiLevelFlags (void)
 
static BOOL file_matches (LPSTR path)
 
static void test_readonlyfile (void)
 
static void test_readonlyfile_cab (void)
 
static void test_setdirproperty (void)
 
static void test_cabisextracted (void)
 
static BOOL file_exists (LPCSTR file)
 
static BOOL pf_exists (LPCSTR file)
 
static void delete_pfmsitest_files (void)
 
static UINT run_query (MSIHANDLE hdb, MSIHANDLE hrec, const char *query)
 
static void set_transform_summary_info (void)
 
static void generate_transform (void)
 
static void generate_transform_manual (void)
 
static void test_transformprop (void)
 
static void test_currentworkingdir (void)
 
static void set_admin_summary_info (const WCHAR *name)
 
static void test_admin (void)
 
static void set_admin_property_stream (LPCSTR file)
 
static void test_adminprops (void)
 
static void create_pf_data (LPCSTR file, LPCSTR data, BOOL is_file)
 
static void test_missingcab (void)
 
static void test_sourcefolder (void)
 
static void test_customaction51 (void)
 
static void test_installstate (void)
 
static DWORD get_pf_file_size (LPCSTR file)
 
static void test_sourcepath (void)
 
static void test_missingcomponent (void)
 
static void test_sourcedirprop (void)
 
static void test_adminimage (void)
 
static void test_propcase (void)
 
static void test_int_widths (void)
 
static void test_shortcut (void)
 
static void test_preselected (void)
 
static void test_installed_prop (void)
 
static void test_allusers_prop (void)
 
static void process_pending_renames (HKEY hkey)
 
static BOOL file_matches_data (LPCSTR file, LPCSTR data)
 
static void test_file_in_use (void)
 
static void test_file_in_use_cab (void)
 
static void test_feature_override (void)
 
static void test_icon_table (void)
 
static void test_package_validation (void)
 
static void test_upgrade_code (void)
 
static void test_mixed_package (void)
 
static void test_volume_props (void)
 
static void test_shared_component (void)
 
static void test_remove_upgrade_code (void)
 
static void test_feature_tree (void)
 
 START_TEST (install)
 

Variables

static LPCSTR
 
static MSIINSTALLCONTEXT
 
static INSTALLSTATE *static DWORD
 
static INSTALLSTATE *static LPSTR
 
static INSTALLSTATE *static LPDWORD
 
static PSID
 
static PBOOL
 
static LPSTR *static PHANDLE
 
static REGSAM
 
static HMODULE hsrclient = 0
 
static STATEMGRSTATUS *static BOOL is_wow64
 
static const BOOL is_64bit = sizeof(void *) > sizeof(int)
 
static const charmsifile = "msitest.msi"
 
static const charmsifile2 = "winetest2.msi"
 
static const charmstfile = "winetest.mst"
 
static const WCHAR msifileW [] = {'m','s','i','t','e','s','t','.','m','s','i',0}
 
static const WCHAR msifile2W [] = {'w','i','n','e','t','e','s','t','2','.','m','s','i',0}
 
static CHAR CURR_DIR [MAX_PATH]
 
static CHAR PROG_FILES_DIR [MAX_PATH]
 
static CHAR PROG_FILES_DIR_NATIVE [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 aup_property_dat []
 
static const CHAR aup2_property_dat []
 
static const CHAR icon_property_dat []
 
static const CHAR shortcut_dat []
 
static const CHAR condition_dat []
 
static const CHAR up_property_dat []
 
static const CHAR up2_property_dat []
 
static const CHAR up3_property_dat []
 
static const CHAR registry_dat []
 
static const CHAR service_install_dat []
 
static const CHAR service_control_dat []
 
static const CHAR cc_component_dat []
 
static const CHAR cc2_component_dat []
 
static const CHAR cc_feature_dat []
 
static const CHAR cc_feature_comp_dat []
 
static const CHAR cc_file_dat []
 
static const CHAR cc2_file_dat []
 
static const CHAR cc_media_dat []
 
static const CHAR cc3_media_dat []
 
static const CHAR co_file_dat []
 
static const CHAR co_media_dat []
 
static const CHAR co2_media_dat []
 
static const CHAR mm_file_dat []
 
static const CHAR mm_media_dat []
 
static const CHAR ss_media_dat []
 
static const CHAR ui_component_dat []
 
static const CHAR ui_install_ui_seq_dat []
 
static const CHAR ui_custom_action_dat []
 
static const CHAR rof_component_dat []
 
static const CHAR rof_feature_dat []
 
static const CHAR rof_feature_comp_dat []
 
static const CHAR rof_file_dat []
 
static const CHAR rof_media_dat []
 
static const CHAR rofc_file_dat []
 
static const CHAR rofc_media_dat []
 
static const CHAR sdp_install_exec_seq_dat []
 
static const CHAR sdp_custom_action_dat []
 
static const CHAR pv_install_exec_seq_dat []
 
static const CHAR cie_component_dat []
 
static const CHAR cie_feature_comp_dat []
 
static const CHAR cie_file_dat []
 
static const CHAR cie_media_dat []
 
static const CHAR ci_component_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 tp_component_dat []
 
static const CHAR cwd_component_dat []
 
static const CHAR adm_component_dat []
 
static const CHAR adm_custom_action_dat []
 
static const CHAR adm_admin_exec_seq_dat []
 
static const CHAR amp_component_dat []
 
static const CHAR rem_install_exec_seq_dat []
 
static const CHAR mc_component_dat []
 
static const CHAR mc_file_dat []
 
static const CHAR mc_media_dat []
 
static const CHAR mc_file_hash_dat []
 
static const CHAR wrv_component_dat []
 
static const CHAR ca51_component_dat []
 
static const CHAR ca51_install_exec_seq_dat []
 
static const CHAR ca51_custom_action_dat []
 
static const CHAR is_feature_dat []
 
static const CHAR is_component_dat []
 
static const CHAR is_feature_comp_dat []
 
static const CHAR is_file_dat []
 
static const CHAR is_media_dat []
 
static const CHAR sp_component_dat []
 
static const CHAR sp_directory_dat []
 
static const CHAR mcp_component_dat []
 
static const CHAR mcp_feature_dat []
 
static const CHAR mcp_feature_comp_dat []
 
static const CHAR mcp_file_dat []
 
static const CHAR ai_file_dat []
 
static const CHAR ip_install_exec_seq_dat []
 
static const CHAR ip_custom_action_dat []
 
static const CHAR aup_install_exec_seq_dat []
 
static const CHAR aup2_install_exec_seq_dat []
 
static const CHAR aup3_install_exec_seq_dat []
 
static const CHAR aup_custom_action_dat []
 
static const CHAR fo_file_dat []
 
static const CHAR fo_feature_dat []
 
static const CHAR fo_condition_dat []
 
static const CHAR fo_feature_comp_dat []
 
static const CHAR fo_component_dat []
 
static const CHAR fo_custom_action_dat []
 
static const CHAR fo_install_exec_seq_dat []
 
static const CHAR uc_file_dat []
 
static const CHAR uc_feature_dat []
 
static const CHAR uc_feature_comp_dat []
 
static const CHAR uc_component_dat []
 
static const CHAR uc_property_dat []
 
static const CHAR uc_install_exec_seq_dat []
 
static const char mixed_feature_dat []
 
static const char mixed_feature_comp_dat []
 
static const char mixed_component_dat []
 
static const char mixed_registry_dat []
 
static const char mixed_install_exec_seq_dat []
 
static const char vp_file_dat []
 
static const char vp_feature_dat []
 
static const char vp_feature_comp_dat []
 
static const char vp_component_dat []
 
static const char vp_custom_action_dat []
 
static const char vp_install_exec_seq_dat []
 
static const char shc_property_dat []
 
static const char shc2_property_dat []
 
static const char shc_file_dat []
 
static const char shc_feature_dat []
 
static const char shc_feature_comp_dat []
 
static const char shc_component_dat []
 
static const char shc_custom_action_dat []
 
static const char shc_install_exec_seq_dat []
 
static const char ft_file_dat []
 
static const char ft_comp_dat []
 
static const char ft_feature_dat []
 
static const char ft_feature_comp_dat []
 
static const char ft_condition_dat []
 
static const char ft_custom_action_dat []
 
static const char ft_install_exec_seq_dat []
 
static const msi_table tables []
 
static const msi_table sc_tables []
 
static const msi_table ps_tables []
 
static const msi_table up_tables []
 
static const msi_table up2_tables []
 
static const msi_table up3_tables []
 
static const msi_table up4_tables []
 
static const msi_table up5_tables []
 
static const msi_table up6_tables []
 
static const msi_table up7_tables []
 
static const msi_table cc_tables []
 
static const msi_table cc2_tables []
 
static const msi_table cc3_tables []
 
static const msi_table co_tables []
 
static const msi_table co2_tables []
 
static const msi_table mm_tables []
 
static const msi_table ss_tables []
 
static const msi_table ui_tables []
 
static const msi_table rof_tables []
 
static const msi_table rofc_tables []
 
static const msi_table sdp_tables []
 
static const msi_table cie_tables []
 
static const msi_table tp_tables []
 
static const msi_table cwd_tables []
 
static const msi_table adm_tables []
 
static const msi_table amp_tables []
 
static const msi_table mc_tables []
 
static const msi_table sf_tables []
 
static const msi_table ca51_tables []
 
static const msi_table is_tables []
 
static const msi_table sp_tables []
 
static const msi_table mcp_tables []
 
static const msi_table ai_tables []
 
static const msi_table pc_tables []
 
static const msi_table ip_tables []
 
static const msi_table aup_tables []
 
static const msi_table aup2_tables []
 
static const msi_table aup3_tables []
 
static const msi_table aup4_tables []
 
static const msi_table fiu_tables []
 
static const msi_table fiuc_tables []
 
static const msi_table fo_tables []
 
static const msi_table icon_base_tables []
 
static const msi_table pv_tables []
 
static const msi_table uc_tables []
 
static const msi_table mixed_tables []
 
static const msi_table vp_tables []
 
static const msi_table shc_tables []
 
static const msi_table shc2_tables []
 
static const msi_table ft_tables []
 
static const WCHAR name1 [] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0 }
 
static const WCHAR name2 [] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0x482f, 0 }
 
static const WCHAR name3 [] = { 0x4840, 0x4559, 0x44f2, 0x4568, 0x4737, 0 }
 
static const char data1 []
 
static const WCHAR data2 []
 
static const WCHAR data3 []
 
struct {
   LPCWSTR   name
 
   const void *   data
 
   DWORD   size
 
table_transform_data []
 
static const struct sourcepathmap spmap [256]
 
static const char session_manager [] = "System\\CurrentControlSet\\Control\\Session Manager"
 
static const char rename_ops [] = "PendingFileRenameOperations"
 

Macro Definition Documentation

#define _WIN32_MSI   300

Definition at line 21 of file install.c.

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

Definition at line 1293 of file install.c.

#define COBJMACROS

Definition at line 22 of file install.c.

#define create_database_template (   name,
  tables,
  num_tables,
  version,
  template 
)
Value:
create_database_wordcount(name, tables, num_tables, version, 0, template, \
"{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
const XML_Char * version
Definition: expat.h:187
static const msi_table tables[]
Definition: install.c:1295
static void create_database_wordcount(const CHAR *name, const msi_table *tables, int num_tables, INT version, INT wordcount, const char *template, const char *packagecode)
Definition: install.c:2456
Definition: name.c:23

Definition at line 2452 of file install.c.

Referenced by test_mixed_package(), and test_package_validation().

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

Definition at line 3956 of file install.c.

Referenced by test_missingcab().

#define FOLDER_THRESHOLD   900000

Definition at line 1944 of file install.c.

Referenced by set_cab_parameters().

#define GET_PROC (   mod,
  func 
)
Value:
p ## func = (void*)GetProcAddress(mod, #func); \
if(!p ## func) \
trace("GetProcAddress(%s) failed\n", #func);
#define trace(...)
Definition: kmt_test.h:172
if(!(yy_init))
Definition: macro.lex.yy.c:704
#define GetProcAddress(x, y)
Definition: compat.h:410
GLfloat GLfloat p
Definition: glext.h:8902
static int mod
Definition: i386-dis.c:1273

Referenced by init_functionpointers().

Definition at line 3653 of file install.c.

Referenced by generate_transform_manual().

Typedef Documentation

Function Documentation

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

Definition at line 2172 of file install.c.

Referenced by create_cab_file(), and create_cc_test_files().

2173 {
2174  char path[MAX_PATH];
2175  char filename[MAX_PATH];
2176 
2177  lstrcpyA(path, CURR_DIR);
2178  lstrcatA(path, "\\");
2179  lstrcatA(path, file);
2180 
2181  lstrcpyA(filename, file);
2182 
2183  return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet,
2185 }
#define FALSE
Definition: types.h:117
LPCSTR filename
Definition: alphablend.c:63
static CHAR CURR_DIR[MAX_PATH]
Definition: install.c:64
static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime, USHORT *pattribs, int *err, void *pv)
Definition: install.c:2146
static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
Definition: install.c:1958
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:311
static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
Definition: install.c:1964
BOOL __cdecl FCIAddFile(HFCI hfci, char *pszSourceFile, char *pszFileName, BOOL fExecute, PFNFCIGETNEXTCABINET pfnfcignc, PFNFCISTATUS pfnfcis, PFNFCIGETOPENINFO pfnfcigoi, TCOMP typeCompress)
Definition: fci.c:1385
Definition: fci.c:114
static BOOL ( WINAPI pCheckTokenMembership)
static
static BOOL check_record ( MSIHANDLE  rec,
UINT  field,
LPCSTR  val 
)
static

Definition at line 2116 of file install.c.

Referenced by test_packagecoltypes().

2117 {
2118  CHAR buffer[0x20];
2119  UINT r;
2120  DWORD sz;
2121 
2122  sz = sizeof buffer;
2123  r = MsiRecordGetStringA(rec, field, buffer, &sz);
2124  return (r == ERROR_SUCCESS ) && !strcmp(val, buffer);
2125 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
char CHAR
Definition: xmlstorage.h:175
GLuint buffer
Definition: glext.h:5915
UINT WINAPI MsiRecordGetStringA(MSIHANDLE handle, UINT iField, LPSTR szValue, LPDWORD pcchValue)
Definition: record.c:422
DWORD DWORD
Definition: winlogon.h:75
GLuint GLfloat * val
Definition: glext.h:7180
Definition: parser.c:43
unsigned int UINT
Definition: ndis.h:50
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
static void check_service_is_installed ( void  )
static

Definition at line 2494 of file install.c.

Referenced by test_MsiInstallProduct().

2495 {
2496  SC_HANDLE scm, service;
2497  BOOL res;
2498 
2500  ok(scm != NULL, "Failed to open the SC Manager\n");
2501 
2502  service = OpenServiceA(scm, "TestService", SC_MANAGER_ALL_ACCESS);
2503  ok(service != NULL, "Failed to open TestService\n");
2504 
2505  res = DeleteService(service);
2506  ok(res, "Failed to delete TestService\n");
2507 
2508  CloseServiceHandle(service);
2509  CloseServiceHandle(scm);
2510 }
BOOL WINAPI DeleteService(SC_HANDLE hService)
Definition: scm.c:771
SC_HANDLE WINAPI OpenSCManagerA(LPCSTR lpMachineName, LPCSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:1790
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:458
smooth NULL
Definition: ftsmooth.c:557
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SC_MANAGER_ALL_ACCESS
Definition: winsvc.h:13
SC_HANDLE WINAPI OpenServiceA(SC_HANDLE hSCManager, LPCSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:1880
GLuint res
Definition: glext.h:9613
#define ok(value,...)
Definition: CImage.cpp:33
static BOOL compare_pf_data ( const char filename,
const char data,
DWORD  size 
)
static

Definition at line 2370 of file install.c.

Referenced by test_missingcab().

2371 {
2372  DWORD read;
2373  HANDLE handle;
2374  BOOL ret = FALSE;
2375  char *buffer, path[MAX_PATH];
2376 
2377  lstrcpyA(path, PROG_FILES_DIR);
2378  lstrcatA(path, "\\");
2379  lstrcatA(path, filename);
2380 
2382  buffer = HeapAlloc(GetProcessHeap(), 0, size);
2383  if (buffer)
2384  {
2385  ReadFile(handle, buffer, size, &read, NULL);
2386  if (read == size && !memcmp(data, buffer, size)) ret = TRUE;
2387  HeapFree(GetProcessHeap(), 0, buffer);
2388  }
2389  CloseHandle(handle);
2390  return ret;
2391 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:79
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
GLuint buffer
Definition: glext.h:5915
static CHAR PROG_FILES_DIR[MAX_PATH]
Definition: install.c:65
DWORD DWORD
Definition: winlogon.h:75
#define FALSE
Definition: types.h:117
LPCSTR filename
Definition: alphablend.c:63
smooth NULL
Definition: ftsmooth.c:557
#define OPEN_EXISTING
Definition: compat.h:426
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#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
int ret
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define GENERIC_READ
Definition: compat.h:124
DWORD *typedef HANDLE
Definition: winlogon.h:52
GLsizeiptr size
Definition: glext.h:5919
Definition: services.c:311
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399
BOOL WINAPI ReadFile(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead, OUT LPDWORD lpNumberOfBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:123
#define HeapFree(x, y, z)
Definition: compat.h:394
_CRTIMP int __cdecl read(_In_ int _FileHandle, _Out_writes_bytes_(_MaxCharCount) void *_DstBuf, _In_ unsigned int _MaxCharCount)
static void create_cab_file ( const CHAR name,
DWORD  max_size,
const CHAR files 
)
static

Definition at line 2200 of file install.c.

Referenced by create_cc_test_files(), create_test_files(), test_cabisextracted(), test_caborder(), test_file_in_use_cab(), test_missingcab(), test_mixedmedia(), and test_readonlyfile_cab().

2201 {
2202  CCAB cabParams;
2203  LPCSTR ptr;
2204  HFCI hfci;
2205  ERF erf;
2206  BOOL res;
2207 
2208  set_cab_parameters(&cabParams, name, max_size);
2209 
2212  get_temp_file, &cabParams, NULL);
2213 
2214  ok(hfci != NULL, "Failed to create an FCI context\n");
2215 
2216  ptr = files;
2217  while (*ptr)
2218  {
2219  res = add_file(hfci, ptr, tcompTYPE_MSZIP);
2220  ok(res, "Failed to add file: %s\n", ptr);
2221  ptr += lstrlenA(ptr) + 1;
2222  }
2223 
2225  ok(res, "Failed to flush the cabinet\n");
2226 
2227  res = FCIDestroy(hfci);
2228  ok(res, "Failed to destroy the cabinet\n");
2229 }
BOOL __cdecl FCIFlushCabinet(HFCI hfci, BOOL fGetNextCab, PFNFCIGETNEXTCABINET pfnfcignc, PFNFCISTATUS pfnfcis)
Definition: fci.c:1663
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:986
BOOL __cdecl FCIDestroy(HFCI hfci)
Definition: fci.c:1697
static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
Definition: install.c:2172
static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
Definition: install.c:2023
Definition: fci.h:144
#define tcompTYPE_MSZIP
Definition: fci.h:65
#define FALSE
Definition: types.h:117
static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
Definition: install.c:1999
Definition: cabinet.h:5
static PVOID ptr
Definition: dispmode.c:30
static INT max_size
Definition: history.c:51
smooth NULL
Definition: ftsmooth.c:557
const char * LPCSTR
Definition: xmlstorage.h:183
static void *CDECL mem_alloc(ULONG cb)
Definition: install.c:1948
static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
Definition: install.c:2187
static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
Definition: install.c:1958
unsigned int BOOL
Definition: ntddk_ex.h:94
double __cdecl erf(double)
static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
Definition: install.c:2011
static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
Definition: install.c:1975
static void CDECL mem_free(void *memory)
Definition: install.c:1953
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
static int CDECL fci_delete(char *pszFile, int *err, void *pv)
Definition: install.c:2042
static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
Definition: install.c:1964
Definition: name.c:23
GLuint res
Definition: glext.h:9613
static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
Definition: install.c:2127
#define ok(value,...)
Definition: CImage.cpp:33
static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
Definition: install.c:2031
static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile, BOOL fContinuation, void *pv)
Definition: install.c:1969
static void create_cc_test_files ( void  )
static

Definition at line 2942 of file install.c.

Referenced by test_caborder(), test_continuouscabs(), test_samesequence(), and test_uiLevelFlags().

2943 {
2944  CCAB cabParams;
2945  HFCI hfci;
2946  ERF erf;
2947  static CHAR cab_context[] = "test%d.cab";
2948  BOOL res;
2949 
2950  create_file("maximus", 500);
2951  create_file("augustus", 50000);
2952  create_file("tiberius", 500);
2953  create_file("caesar", 500);
2954 
2955  set_cab_parameters(&cabParams, "test1.cab", 40000);
2956 
2959  get_temp_file, &cabParams, cab_context);
2960  ok(hfci != NULL, "Failed to create an FCI context\n");
2961 
2962  res = add_file(hfci, "maximus", tcompTYPE_NONE);
2963  ok(res, "Failed to add file maximus\n");
2964 
2965  res = add_file(hfci, "augustus", tcompTYPE_NONE);
2966  ok(res, "Failed to add file augustus\n");
2967 
2968  res = add_file(hfci, "tiberius", tcompTYPE_NONE);
2969  ok(res, "Failed to add file tiberius\n");
2970 
2972  ok(res, "Failed to flush the cabinet\n");
2973 
2974  res = FCIDestroy(hfci);
2975  ok(res, "Failed to destroy the cabinet\n");
2976 
2977  create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
2978 
2979  DeleteFileA("maximus");
2980  DeleteFileA("augustus");
2981  DeleteFileA("tiberius");
2982  DeleteFileA("caesar");
2983 }
#define MEDIA_SIZE
Definition: install.c:1943
BOOL __cdecl FCIFlushCabinet(HFCI hfci, BOOL fGetNextCab, PFNFCIGETNEXTCABINET pfnfcignc, PFNFCISTATUS pfnfcis)
Definition: fci.c:1663
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:986
char CHAR
Definition: xmlstorage.h:175
BOOL __cdecl FCIDestroy(HFCI hfci)
Definition: fci.c:1697
static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
Definition: install.c:2172
static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
Definition: install.c:2023
Definition: fci.h:144
#define create_file(name, size)
Definition: install.c:2306
#define FALSE
Definition: types.h:117
static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
Definition: install.c:1999
Definition: cabinet.h:5
smooth NULL
Definition: ftsmooth.c:557
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
static void *CDECL mem_alloc(ULONG cb)
Definition: install.c:1948
static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
Definition: install.c:2187
static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
Definition: install.c:1958
unsigned int BOOL
Definition: ntddk_ex.h:94
#define tcompTYPE_NONE
Definition: fci.h:64
double __cdecl erf(double)
static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
Definition: install.c:2011
static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
Definition: install.c:1975
static void CDECL mem_free(void *memory)
Definition: install.c:1953
static int CDECL fci_delete(char *pszFile, int *err, void *pv)
Definition: install.c:2042
static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
Definition: install.c:1964
GLuint res
Definition: glext.h:9613
static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
Definition: install.c:2127
#define ok(value,...)
Definition: CImage.cpp:33
static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
Definition: install.c:2031
static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile, BOOL fContinuation, void *pv)
Definition: install.c:1969
static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
Definition: install.c:2200
static void create_database_wordcount ( const CHAR name,
const msi_table tables,
int  num_tables,
INT  version,
INT  wordcount,
const char template,
const char packagecode 
)
static

Definition at line 2456 of file install.c.

Referenced by test_adminimage(), and test_shared_component().

2459 {
2460  MSIHANDLE db;
2461  UINT r;
2462  WCHAR *nameW;
2463  int j, len;
2464 
2465  len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
2466  if (!(nameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return;
2467  MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, len );
2468 
2469  r = MsiOpenDatabaseW(nameW, MSIDBOPEN_CREATE, &db);
2470  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2471 
2472  /* import the tables into the database */
2473  for (j = 0; j < num_tables; j++)
2474  {
2475  const msi_table *table = &tables[j];
2476 
2477  write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
2478 
2479  r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
2480  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2481 
2482  DeleteFileA(table->filename);
2483  }
2484 
2485  write_msi_summary_info(db, version, wordcount, template, packagecode);
2486 
2487  r = MsiDatabaseCommit(db);
2488  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2489 
2490  MsiCloseHandle(db);
2491  HeapFree( GetProcessHeap(), 0, nameW );
2492 }
const XML_Char * version
Definition: expat.h:187
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint 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 GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum const GLdouble const GLfloat const GLdouble const GLfloat GLenum GLint GLint GLint GLint GLint GLint j
Definition: glfuncs.h:98
#define ERROR_SUCCESS
Definition: deptool.c:10
__wchar_t WCHAR
Definition: xmlstorage.h:180
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: install.c:2407
const char * data
Definition: patch.c:126
smooth NULL
Definition: ftsmooth.c:557
static CHAR CURR_DIR[MAX_PATH]
Definition: install.c:64
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
static const WCHAR nameW[]
Definition: main.c:46
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define MSIDBOPEN_CREATE
Definition: msiquery.h:69
static void write_msi_summary_info(MSIHANDLE db, INT version, INT wordcount, const char *template, const char *packagecode)
Definition: install.c:2417
GLenum GLsizei len
Definition: glext.h:6722
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:259
UINT WINAPI MsiDatabaseCommit(MSIHANDLE hdb)
Definition: msiquery.c:794
UINT WINAPI MsiOpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIHANDLE *phDB)
Definition: database.c:286
unsigned int UINT
Definition: ndis.h:50
const char * filename
Definition: patch.c:125
#define MultiByteToWideChar
Definition: compat.h:100
int size
Definition: patch.c:127
Definition: name.c:23
#define ok(value,...)
Definition: CImage.cpp:33
#define HeapFree(x, y, z)
Definition: compat.h:394
UINT WINAPI MsiDatabaseImportA(MSIHANDLE handle, LPCSTR szFolder, LPCSTR szFilename)
Definition: database.c:880
static void create_file_data ( LPCSTR  name,
LPCSTR  data,
DWORD  size 
)
static

Definition at line 2286 of file install.c.

Referenced by create_pf_data().

2287 {
2288  HANDLE file;
2289  DWORD written;
2290 
2292  if (file == INVALID_HANDLE_VALUE)
2293  return;
2294 
2295  WriteFile(file, data, strlen(data), &written, NULL);
2296 
2297  if (size)
2298  {
2300  SetEndOfFile(file);
2301  }
2302 
2303  CloseHandle(file);
2304 }
#define CloseHandle
Definition: compat.h:398
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
BOOL WINAPI SetEndOfFile(HANDLE hFile)
Definition: fileinfo.c:1134
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD DWORD
Definition: winlogon.h:75
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:557
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
const char file[]
Definition: icontest.c:11
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:110
DWORD *typedef HANDLE
Definition: winlogon.h:52
GLsizeiptr size
Definition: glext.h:5919
Definition: name.c:23
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399
static void create_pf_data ( LPCSTR  file,
LPCSTR  data,
BOOL  is_file 
)
static

Definition at line 3942 of file install.c.

Referenced by test_missingcab().

3943 {
3944  CHAR path[MAX_PATH];
3945 
3946  lstrcpyA(path, PROG_FILES_DIR);
3947  lstrcatA(path, "\\");
3948  lstrcatA(path, file);
3949 
3950  if (is_file)
3951  create_file_data(path, data, 500);
3952  else
3953  CreateDirectoryA(path, NULL);
3954 }
char CHAR
Definition: xmlstorage.h:175
static CHAR PROG_FILES_DIR[MAX_PATH]
Definition: install.c:65
static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
Definition: install.c:2286
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
smooth NULL
Definition: ftsmooth.c:557
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:311
Definition: fci.c:114
static void create_test_files ( void  )
static

Definition at line 2308 of file install.c.

Referenced by test_allusers_prop(), test_feature_override(), test_installed_prop(), test_MsiInstallProduct(), test_preselected(), test_remove_upgrade_code(), and test_shortcut().

2309 {
2310  CreateDirectoryA("msitest", NULL);
2311  create_file("msitest\\one.txt", 100);
2312  CreateDirectoryA("msitest\\first", NULL);
2313  create_file("msitest\\first\\two.txt", 100);
2314  CreateDirectoryA("msitest\\second", NULL);
2315  create_file("msitest\\second\\three.txt", 100);
2316 
2317  create_file("four.txt", 100);
2318  create_file("five.txt", 100);
2319  create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
2320 
2321  create_file("msitest\\filename", 100);
2322  create_file("msitest\\service.exe", 100);
2323 
2324  DeleteFileA("four.txt");
2325  DeleteFileA("five.txt");
2326 }
#define MEDIA_SIZE
Definition: install.c:1943
#define create_file(name, size)
Definition: install.c:2306
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
smooth NULL
Definition: ftsmooth.c:557
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
Definition: install.c:2200
static void delete_cab_files ( void  )
static

Definition at line 2985 of file install.c.

Referenced by test_cabisextracted(), test_caborder(), test_continuouscabs(), test_file_in_use_cab(), test_readonlyfile_cab(), test_samesequence(), and test_uiLevelFlags().

2986 {
2987  SHFILEOPSTRUCTA shfl;
2988  CHAR path[MAX_PATH+10];
2989 
2990  lstrcpyA(path, CURR_DIR);
2991  lstrcatA(path, "\\*.cab");
2992  path[strlen(path) + 1] = '\0';
2993 
2994  shfl.hwnd = NULL;
2995  shfl.wFunc = FO_DELETE;
2996  shfl.pFrom = path;
2997  shfl.pTo = NULL;
2999 
3000  SHFileOperationA(&shfl);
3001 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLsizei const GLchar ** path
Definition: glext.h:7234
FILEOP_FLAGS fFlags
Definition: shellapi.h:324
#define FOF_SILENT
Definition: shellapi.h:117
char CHAR
Definition: xmlstorage.h:175
#define FOF_NOCONFIRMATION
Definition: shellapi.h:119
smooth NULL
Definition: ftsmooth.c:557
static CHAR CURR_DIR[MAX_PATH]
Definition: install.c:64
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
#define FOF_NORECURSION
Definition: shlfileop.c:36
#define FOF_FILESONLY
Definition: shellapi.h:122
#define MAX_PATH
Definition: compat.h:26
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
Definition: services.c:311
int WINAPI SHFileOperationA(LPSHFILEOPSTRUCTA lpFileOp)
Definition: shlfileop.cpp:997
#define FO_DELETE
Definition: shellapi.h:112
static BOOL delete_cf ( const CHAR rel_path,
BOOL  is_file 
)
static

Definition at line 2356 of file install.c.

Referenced by test_setdirproperty().

2357 {
2358  CHAR path[MAX_PATH];
2359 
2360  lstrcpyA(path, COMMON_FILES_DIR);
2361  lstrcatA(path, "\\");
2362  lstrcatA(path, rel_path);
2363 
2364  if (is_file)
2365  return DeleteFileA(path);
2366  else
2367  return RemoveDirectoryA(path);
2368 }
char CHAR
Definition: xmlstorage.h:175
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
#define MAX_PATH
Definition: compat.h:26
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
Definition: services.c:311
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
static CHAR COMMON_FILES_DIR[MAX_PATH]
Definition: install.c:67
static LONG delete_key ( HKEY  key,
LPCSTR  subkey,
REGSAM  access 
)
static

Definition at line 2533 of file install.c.

Referenced by test_feature_override(), and test_MsiInstallProduct().

2534 {
2535  if (pRegDeleteKeyExA)
2536  return pRegDeleteKeyExA( key, subkey, access, 0 );
2537  return RegDeleteKeyA( key, subkey );
2538 }
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1225
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
Definition: path.c:42
static BOOL delete_pf ( const CHAR rel_path,
BOOL  is_file 
)
static

Definition at line 2328 of file install.c.

Referenced by test_admin(), test_adminimage(), test_adminprops(), test_allusers_prop(), test_cabisextracted(), test_caborder(), test_continuouscabs(), test_currentworkingdir(), test_customaction51(), test_feature_override(), test_file_in_use(), test_file_in_use_cab(), test_installed_prop(), test_installstate(), test_missingcab(), test_missingcomponent(), test_mixedmedia(), test_MsiInstallProduct(), test_package_validation(), test_preselected(), test_propcase(), test_readonlyfile(), test_readonlyfile_cab(), test_samesequence(), test_shortcut(), test_sourcedirprop(), test_sourcefolder(), test_sourcepath(), test_transformprop(), test_uiLevelFlags(), and test_upgrade_code().

2329 {
2330  CHAR path[MAX_PATH];
2331 
2332  lstrcpyA(path, PROG_FILES_DIR);
2333  lstrcatA(path, "\\");
2334  lstrcatA(path, rel_path);
2335 
2336  if (is_file)
2337  return DeleteFileA(path);
2338  else
2339  return RemoveDirectoryA(path);
2340 }
char CHAR
Definition: xmlstorage.h:175
static CHAR PROG_FILES_DIR[MAX_PATH]
Definition: install.c:65
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:311
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
static BOOL delete_pf_native ( const CHAR rel_path,
BOOL  is_file 
)
static

Definition at line 2342 of file install.c.

Referenced by test_package_validation().

2343 {
2344  CHAR path[MAX_PATH];
2345 
2347  lstrcatA(path, "\\");
2348  lstrcatA(path, rel_path);
2349 
2350  if (is_file)
2351  return DeleteFileA(path);
2352  else
2353  return RemoveDirectoryA(path);
2354 }
char CHAR
Definition: xmlstorage.h:175
static CHAR PROG_FILES_DIR_NATIVE[MAX_PATH]
Definition: install.c:66
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:311
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
static void delete_pfmsitest_files ( void  )
static

Definition at line 3519 of file install.c.

Referenced by test_icon_table().

3520 {
3521  SHFILEOPSTRUCTA shfl;
3522  CHAR path[MAX_PATH+11];
3523 
3524  lstrcpyA(path, PROG_FILES_DIR);
3525  lstrcatA(path, "\\msitest\\*");
3526  path[strlen(path) + 1] = '\0';
3527 
3528  shfl.hwnd = NULL;
3529  shfl.wFunc = FO_DELETE;
3530  shfl.pFrom = path;
3531  shfl.pTo = NULL;
3533 
3534  SHFileOperationA(&shfl);
3535 
3536  lstrcpyA(path, PROG_FILES_DIR);
3537  lstrcatA(path, "\\msitest");
3538  RemoveDirectoryA(path);
3539 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLsizei const GLchar ** path
Definition: glext.h:7234
FILEOP_FLAGS fFlags
Definition: shellapi.h:324
#define FOF_SILENT
Definition: shellapi.h:117
char CHAR
Definition: xmlstorage.h:175
static CHAR PROG_FILES_DIR[MAX_PATH]
Definition: install.c:65
#define FOF_NOERRORUI
Definition: shellapi.h:125
#define FOF_NOCONFIRMATION
Definition: shellapi.h:119
smooth NULL
Definition: ftsmooth.c:557
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
#define FOF_NORECURSION
Definition: shlfileop.c:36
#define FOF_FILESONLY
Definition: shellapi.h:122
#define MAX_PATH
Definition: compat.h:26
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
Definition: services.c:311
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
int WINAPI SHFileOperationA(LPSHFILEOPSTRUCTA lpFileOp)
Definition: shlfileop.cpp:997
#define FO_DELETE
Definition: shellapi.h:112
static void delete_test_files ( void  )
static

Definition at line 2393 of file install.c.

Referenced by test_allusers_prop(), test_feature_override(), test_file_in_use(), test_file_in_use_cab(), test_installed_prop(), test_MsiInstallProduct(), test_preselected(), and test_shortcut().

2394 {
2395  DeleteFileA("msitest.msi");
2396  DeleteFileA("msitest.cab");
2397  DeleteFileA("msitest\\second\\three.txt");
2398  DeleteFileA("msitest\\first\\two.txt");
2399  DeleteFileA("msitest\\one.txt");
2400  DeleteFileA("msitest\\service.exe");
2401  DeleteFileA("msitest\\filename");
2402  RemoveDirectoryA("msitest\\second");
2403  RemoveDirectoryA("msitest\\first");
2404  RemoveDirectoryA("msitest");
2405 }
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
static int CDECL fci_close ( INT_PTR  hf,
int err,
void pv 
)
static

Definition at line 2023 of file install.c.

Referenced by create_cab_file(), and create_cc_test_files().

2024 {
2025  HANDLE handle = (HANDLE)hf;
2026  ok(CloseHandle(handle), "Failed to CloseHandle\n");
2027 
2028  return 0;
2029 }
#define CloseHandle
Definition: compat.h:398
DWORD *typedef HANDLE
Definition: winlogon.h:52
#define ok(value,...)
Definition: CImage.cpp:33
static int CDECL fci_delete ( char pszFile,
int err,
void pv 
)
static

Definition at line 2042 of file install.c.

Referenced by create_cab_file(), and create_cc_test_files().

2043 {
2044  BOOL ret = DeleteFileA(pszFile);
2045  ok(ret, "Failed to DeleteFile %s\n", pszFile);
2046 
2047  return 0;
2048 }
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
unsigned int BOOL
Definition: ntddk_ex.h:94
int ret
#define ok(value,...)
Definition: CImage.cpp:33
static INT_PTR CDECL fci_open ( char pszFile,
int  oflag,
int  pmode,
int err,
void pv 
)
static

Definition at line 1975 of file install.c.

Referenced by create_cab_file(), and create_cc_test_files().

1976 {
1977  HANDLE handle;
1978  DWORD dwAccess = 0;
1979  DWORD dwShareMode = 0;
1980  DWORD dwCreateDisposition = OPEN_EXISTING;
1981 
1982  dwAccess = GENERIC_READ | GENERIC_WRITE;
1983  /* FILE_SHARE_DELETE is not supported by Windows Me/98/95 */
1984  dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
1985 
1987  dwCreateDisposition = OPEN_EXISTING;
1988  else
1989  dwCreateDisposition = CREATE_NEW;
1990 
1991  handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
1992  dwCreateDisposition, 0, NULL);
1993 
1994  ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
1995 
1996  return (INT_PTR)handle;
1997 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:79
#define INVALID_FILE_ATTRIBUTES
Definition: test.h:47
#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
DWORD DWORD
Definition: winlogon.h:75
#define FILE_SHARE_READ
Definition: compat.h:125
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:766
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:557
#define OPEN_EXISTING
Definition: compat.h:426
#define GENERIC_READ
Definition: compat.h:124
DWORD *typedef HANDLE
Definition: winlogon.h:52
#define ok(value,...)
Definition: CImage.cpp:33
#define CREATE_NEW
Definition: disk.h:69
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399
static UINT CDECL fci_read ( INT_PTR  hf,
void memory,
UINT  cb,
int err,
void pv 
)
static

Definition at line 1999 of file install.c.

Referenced by create_cab_file(), and create_cc_test_files().

2000 {
2001  HANDLE handle = (HANDLE)hf;
2002  DWORD dwRead;
2003  BOOL res;
2004 
2005  res = ReadFile(handle, memory, cb, &dwRead, NULL);
2006  ok(res, "Failed to ReadFile\n");
2007 
2008  return dwRead;
2009 }
DWORD DWORD
Definition: winlogon.h:75
smooth NULL
Definition: ftsmooth.c:557
void UINT cb
Definition: fci.h:175
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD *typedef HANDLE
Definition: winlogon.h:52
GLuint res
Definition: glext.h:9613
#define ok(value,...)
Definition: CImage.cpp:33
BOOL WINAPI ReadFile(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead, OUT LPDWORD lpNumberOfBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:123
static LONG CDECL fci_seek ( INT_PTR  hf,
LONG  dist,
int  seektype,
int err,
void pv 
)
static

Definition at line 2031 of file install.c.

Referenced by create_cab_file(), and create_cc_test_files().

2032 {
2033  HANDLE handle = (HANDLE)hf;
2034  DWORD ret;
2035 
2036  ret = SetFilePointer(handle, dist, NULL, seektype);
2037  ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
2038 
2039  return ret;
2040 }
#define INVALID_SET_FILE_POINTER
Definition: winbase.h:113
LONG dist
Definition: fci.h:184
DWORD DWORD
Definition: winlogon.h:75
DWORD WINAPI DECLSPEC_HOTPATCH SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod)
Definition: fileinfo.c:204
smooth NULL
Definition: ftsmooth.c:557
int ret
DWORD *typedef HANDLE
Definition: winlogon.h:52
LONG int seektype
Definition: fci.h:184
#define ok(value,...)
Definition: CImage.cpp:33
static UINT CDECL fci_write ( INT_PTR  hf,
void memory,
UINT  cb,
int err,
void pv 
)
static

Definition at line 2011 of file install.c.

Referenced by create_cab_file(), and create_cc_test_files().

2012 {
2013  HANDLE handle = (HANDLE)hf;
2014  DWORD dwWritten;
2015  BOOL res;
2016 
2017  res = WriteFile(handle, memory, cb, &dwWritten, NULL);
2018  ok(res, "Failed to WriteFile\n");
2019 
2020  return dwWritten;
2021 }
DWORD DWORD
Definition: winlogon.h:75
smooth NULL
Definition: ftsmooth.c:557
void UINT cb
Definition: fci.h:175
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD *typedef HANDLE
Definition: winlogon.h:52
GLuint res
Definition: glext.h:9613
#define ok(value,...)
Definition: CImage.cpp:33
static BOOL file_exists ( LPCSTR  file)
static

Definition at line 3503 of file install.c.

Referenced by pf_exists(), and test_icon_table().

3504 {
3506 }
#define INVALID_FILE_ATTRIBUTES
Definition: test.h:47
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:766
Definition: fci.c:114
static BOOL file_matches ( LPSTR  path)
static

Definition at line 3298 of file install.c.

Referenced by test_readonlyfile().

3299 {
3300  CHAR buf[MAX_PATH];
3301  HANDLE file;
3302  DWORD size;
3303 
3305  NULL, OPEN_EXISTING, 0, NULL);
3306  ZeroMemory(buf, MAX_PATH);
3307  ReadFile(file, buf, 15, &size, NULL);
3308  CloseHandle(file);
3309 
3310  return !lstrcmpA(buf, "msitest\\maximus");
3311 }
DWORD size
Definition: install.c:3645
#define CloseHandle
Definition: compat.h:398
char CHAR
Definition: xmlstorage.h:175
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
#define ZeroMemory
Definition: winbase.h:1621
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
DWORD DWORD
Definition: winlogon.h:75
#define FILE_SHARE_READ
Definition: compat.h:125
smooth NULL
Definition: ftsmooth.c:557
#define OPEN_EXISTING
Definition: compat.h:426
#define MAX_PATH
Definition: compat.h:26
const char file[]
Definition: icontest.c:11
#define GENERIC_READ
Definition: compat.h:124
DWORD *typedef HANDLE
Definition: winlogon.h:52
Definition: services.c:311
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399
BOOL WINAPI ReadFile(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead, OUT LPDWORD lpNumberOfBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:123
static BOOL file_matches_data ( LPCSTR  file,
LPCSTR  data 
)
static

Definition at line 5217 of file install.c.

Referenced by test_file_in_use(), and test_file_in_use_cab().

5218 {
5219  DWORD len, data_len = strlen(data);
5220  HANDLE handle;
5221  char buf[128];
5222 
5224  ok(handle != INVALID_HANDLE_VALUE, "failed to open %s (%u)\n", file, GetLastError());
5225 
5226  if (ReadFile(handle, buf, sizeof(buf), &len, NULL) && len >= data_len)
5227  {
5228  CloseHandle(handle);
5229  return !memcmp(buf, data, data_len);
5230  }
5231  CloseHandle(handle);
5232  return FALSE;
5233 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:79
#define CloseHandle
Definition: compat.h:398
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
DWORD DWORD
Definition: winlogon.h:75
#define FILE_SHARE_READ
Definition: compat.h:125
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:557
#define OPEN_EXISTING
Definition: compat.h:426
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum GLsizei len
Definition: glext.h:6722
#define GENERIC_READ
Definition: compat.h:124
DWORD *typedef HANDLE
Definition: winlogon.h:52
#define ok(value,...)
Definition: CImage.cpp:33
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399
BOOL WINAPI ReadFile(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead, OUT LPDWORD lpNumberOfBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:123
Definition: fci.c:114
static int CDECL file_placed ( PCCAB  pccab,
char pszFile,
LONG  cbFile,
BOOL  fContinuation,
void pv 
)
static

Definition at line 1969 of file install.c.

Referenced by create_cab_file(), and create_cc_test_files().

1971 {
1972  return 0;
1973 }
static void generate_transform ( void  )
static

Definition at line 3585 of file install.c.

Referenced by test_transformprop().

3586 {
3587  MSIHANDLE hdb1, hdb2;
3588  LPCSTR query;
3589  UINT r;
3590 
3591  /* start with two identical databases */
3593 
3595  ok(r == ERROR_SUCCESS , "Failed to create database\n");
3596 
3597  r = MsiDatabaseCommit(hdb1);
3598  ok(r == ERROR_SUCCESS , "Failed to commit database\n");
3599 
3601  ok(r == ERROR_SUCCESS , "Failed to create database\n");
3602 
3603  query = "INSERT INTO `Property` ( `Property`, `Value` ) VALUES ( 'prop', 'val' )";
3604  r = run_query(hdb1, 0, query);
3605  ok(r == ERROR_SUCCESS, "failed to add property\n");
3606 
3607  /* database needs to be committed */
3608  MsiDatabaseCommit(hdb1);
3609 
3610  r = MsiDatabaseGenerateTransformA(hdb1, hdb2, mstfile, 0, 0);
3611  ok(r == ERROR_SUCCESS, "return code %d, should be ERROR_SUCCESS\n", r);
3612 
3613  r = MsiCreateTransformSummaryInfoA(hdb2, hdb2, mstfile, 0, 0);
3614  todo_wine ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3615 
3616  MsiCloseHandle(hdb1);
3617  MsiCloseHandle(hdb2);
3618 }
#define MSIDBOPEN_READONLY
Definition: msiquery.h:66
static const WCHAR msifileW[]
Definition: install.c:61
#define ERROR_SUCCESS
Definition: deptool.c:10
static const char * msifile
Definition: install.c:57
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static const WCHAR msifile2W[]
Definition: install.c:62
BOOL WINAPI CopyFileA(IN LPCSTR lpExistingFileName, IN LPCSTR lpNewFileName, IN BOOL bFailIfExists)
Definition: copy.c:404
unsigned long MSIHANDLE
Definition: msiserver.idl:25
#define FALSE
Definition: types.h:117
UINT WINAPI MsiDatabaseGenerateTransformA(MSIHANDLE hdb, MSIHANDLE hdbref, LPCSTR szTransformFile, int iReserved1, int iReserved2)
Definition: msiquery.c:778
const char * LPCSTR
Definition: xmlstorage.h:183
#define MSIDBOPEN_TRANSACT
Definition: msiquery.h:67
#define todo_wine
Definition: test.h:154
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:259
static UINT run_query(MSIHANDLE hdb, MSIHANDLE hrec, const char *query)
Definition: install.c:3541
UINT WINAPI MsiDatabaseCommit(MSIHANDLE hdb)
Definition: msiquery.c:794
UINT WINAPI MsiOpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIHANDLE *phDB)
Definition: database.c:286
unsigned int UINT
Definition: ndis.h:50
UINT WINAPI MsiCreateTransformSummaryInfoA(MSIHANDLE db, MSIHANDLE db_ref, LPCSTR transform, int error, int validation)
Definition: suminfo.c:1131
#define ok(value,...)
Definition: CImage.cpp:33
static const char * msifile2
Definition: install.c:58
static const char * mstfile
Definition: install.c:59
GLenum query
Definition: glext.h:7781
static void generate_transform_manual ( void  )
static

Definition at line 3655 of file install.c.

Referenced by test_transformprop().

3656 {
3657  IStorage *stg = NULL;
3658  IStream *stm;
3659  WCHAR name[0x20];
3660  HRESULT r;
3661  DWORD i, count;
3663 
3664  const CLSID CLSID_MsiTransform = { 0xc1082,0,0,{0xc0,0,0,0,0,0,0,0x46}};
3665 
3666  MultiByteToWideChar(CP_ACP, 0, mstfile, -1, name, 0x20);
3667 
3668  r = StgCreateDocfile(name, mode, 0, &stg);
3669  ok(r == S_OK, "failed to create storage\n");
3670  if (!stg)
3671  return;
3672 
3673  r = IStorage_SetClass(stg, &CLSID_MsiTransform);
3674  ok(r == S_OK, "failed to set storage type\n");
3675 
3676  for (i=0; i<NUM_TRANSFORM_TABLES; i++)
3677  {
3678  r = IStorage_CreateStream(stg, table_transform_data[i].name,
3679  STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
3680  if (FAILED(r))
3681  {
3682  ok(0, "failed to create stream %08x\n", r);
3683  continue;
3684  }
3685 
3686  r = IStream_Write(stm, table_transform_data[i].data,
3687  table_transform_data[i].size, &count);
3688  if (FAILED(r) || count != table_transform_data[i].size)
3689  ok(0, "failed to write stream\n");
3690  IStream_Release(stm);
3691  }
3692 
3693  IStorage_Release(stg);
3694 
3696 }
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:922
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define CP_ACP
Definition: compat.h:99
#define STGM_CREATE
Definition: objbase.h:925
DWORD DWORD
Definition: winlogon.h:75
GLenum GLclampf GLint i
Definition: glfuncs.h:14
static void set_transform_summary_info(void)
Definition: install.c:3557
smooth NULL
Definition: ftsmooth.c:557
#define STGM_WRITE
Definition: objbase.h:917
#define NUM_TRANSFORM_TABLES
Definition: install.c:3653
LONG HRESULT
Definition: typedefs.h:77
#define STGM_DIRECT
Definition: objbase.h:913
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
HRESULT WINAPI StgCreateDocfile(LPCOLESTR pwcsName, DWORD grfMode, DWORD reserved, IStorage **ppstgOpen)
Definition: storage32.c:8617
#define STGM_READWRITE
Definition: objbase.h:918
#define S_OK
Definition: intsafe.h:59
GLsizeiptr size
Definition: glext.h:5919
#define MultiByteToWideChar
Definition: compat.h:100
Definition: name.c:23
#define ok(value,...)
Definition: CImage.cpp:33
static const char * mstfile
Definition: install.c:59
static const struct @1451 table_transform_data[]
static BOOL CDECL get_next_cabinet ( PCCAB  pccab,
ULONG  cbPrevCab,
void pv 
)
static

Definition at line 1958 of file install.c.

Referenced by add_file(), create_cab_file(), and create_cc_test_files().

1959 {
1960  sprintf(pccab->szCab, pv, pccab->iCab);
1961  return TRUE;
1962 }
#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
static INT_PTR CDECL get_open_info ( char pszName,
USHORT pdate,
USHORT ptime,
USHORT pattribs,
int err,
void pv 
)
static

Definition at line 2146 of file install.c.

Referenced by add_file().

2148 {
2151  HANDLE handle;
2152  DWORD attrs;
2153  BOOL res;
2154 
2155  handle = CreateFileA(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
2157 
2158  ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
2159 
2160  res = GetFileInformationByHandle(handle, &finfo);
2161  ok(res, "Expected GetFileInformationByHandle to succeed\n");
2162 
2163  FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime);
2164  FileTimeToDosDateTime(&filetime, pdate, ptime);
2165 
2166  attrs = GetFileAttributesA(pszName);
2167  ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
2168 
2169  return (INT_PTR)handle;
2170 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:79
#define INVALID_FILE_ATTRIBUTES
Definition: test.h:47
#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
DWORD DWORD
Definition: winlogon.h:75
#define FILE_SHARE_READ
Definition: compat.h:125
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:766
smooth NULL
Definition: ftsmooth.c:557
#define OPEN_EXISTING
Definition: compat.h:426
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI GetFileInformationByHandle(HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation)
Definition: fileinfo.c:588
#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
DWORD *typedef HANDLE
Definition: winlogon.h:52
#define FILE_FLAG_SEQUENTIAL_SCAN
Definition: disk.h:43
GLuint res
Definition: glext.h:9613
#define ok(value,...)
Definition: CImage.cpp:33
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399
static DWORD get_pf_file_size ( LPCSTR  file)
static

Definition at line 4493 of file install.c.

Referenced by test_sourcepath().

4494 {
4495  CHAR path[MAX_PATH];
4496  HANDLE hfile;
4497  DWORD size;
4498 
4499  lstrcpyA(path, PROG_FILES_DIR);
4500  lstrcatA(path, "\\");
4501  lstrcatA(path, file);
4502 
4504  if (hfile == INVALID_HANDLE_VALUE)
4505  return INVALID_FILE_SIZE;
4506 
4507  size = GetFileSize(hfile, NULL);
4508  CloseHandle(hfile);
4509  return size;
4510 }
DWORD size
Definition: install.c:3645
#define CloseHandle
Definition: compat.h:398
char CHAR
Definition: xmlstorage.h:175
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
static CHAR PROG_FILES_DIR[MAX_PATH]
Definition: install.c:65
#define INVALID_FILE_SIZE
Definition: winbase.h:520
DWORD DWORD
Definition: winlogon.h:75
#define FILE_SHARE_READ
Definition: compat.h:125
smooth NULL
Definition: ftsmooth.c:557
#define OPEN_EXISTING
Definition: compat.h:426
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
#define MAX_PATH
Definition: compat.h:26
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:461
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
#define GENERIC_READ
Definition: compat.h:124
DWORD *typedef HANDLE
Definition: winlogon.h:52
Definition: services.c:311
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399
Definition: fci.c:114
static BOOL get_system_dirs ( void  )
static

Definition at line 2250 of file install.c.

Referenced by START_TEST().

2251 {
2252  HKEY hkey;
2253  DWORD type, size;
2254 
2255  if (RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion", &hkey))
2256  return FALSE;
2257 
2258  size = MAX_PATH;
2259  if (RegQueryValueExA(hkey, "ProgramFilesDir (x86)", 0, &type, (LPBYTE)PROG_FILES_DIR, &size) &&
2260  RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR, &size)) {
2261  RegCloseKey(hkey);
2262  return FALSE;
2263  }
2264 
2265  size = MAX_PATH;
2266  if (RegQueryValueExA(hkey, "CommonFilesDir (x86)", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size) &&
2267  RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size)) {
2268  RegCloseKey(hkey);
2269  return FALSE;
2270  }
2271 
2272  size = MAX_PATH;
2273  if (RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR_NATIVE, &size)) {
2274  RegCloseKey(hkey);
2275  return FALSE;
2276  }
2277 
2278  RegCloseKey(hkey);
2279 
2281  return FALSE;
2282 
2283  return TRUE;
2284 }
DWORD size
Definition: install.c:3645
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3272
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:4041
#define TRUE
Definition: types.h:120
unsigned char * LPBYTE
Definition: typedefs.h:52
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static CHAR PROG_FILES_DIR[MAX_PATH]
Definition: install.c:65
DWORD DWORD
Definition: winlogon.h:75
static CHAR PROG_FILES_DIR_NATIVE[MAX_PATH]
Definition: install.c:66
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define FALSE
Definition: types.h:117
HANDLE HKEY
Definition: registry.h:24
static CHAR WINDOWS_DIR[MAX_PATH]
Definition: install.c:69
#define MAX_PATH
Definition: compat.h:26
UINT WINAPI GetWindowsDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2337
static CHAR COMMON_FILES_DIR[MAX_PATH]
Definition: install.c:67
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
static BOOL CDECL get_temp_file ( char pszTempName,
int  cbTempName,
void pv 
)
static

Definition at line 2127 of file install.c.

Referenced by create_cab_file(), and create_cc_test_files().

2128 {
2129  LPSTR tempname;
2130 
2131  tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
2132  GetTempFileNameA(".", "xx", 0, tempname);
2133 
2134  if (tempname && (strlen(tempname) < (unsigned)cbTempName))
2135  {
2136  lstrcpyA(pszTempName, tempname);
2137  HeapFree(GetProcessHeap(), 0, tempname);
2138  return TRUE;
2139  }
2140 
2141  HeapFree(GetProcessHeap(), 0, tempname);
2142 
2143  return FALSE;
2144 }
#define TRUE
Definition: types.h:120
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * LPSTR
Definition: xmlstorage.h:182
#define FALSE
Definition: types.h:117
#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
static BOOL get_user_dirs ( void  )
static

Definition at line 2231 of file install.c.

Referenced by START_TEST().

2232 {
2233  HKEY hkey;
2234  DWORD type, size;
2235 
2237  "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey))
2238  return FALSE;
2239 
2240  size = MAX_PATH;
2241  if(RegQueryValueExA(hkey, "AppData", 0, &type, (LPBYTE)APP_DATA_DIR, &size)){
2242  RegCloseKey(hkey);
2243  return FALSE;
2244  }
2245 
2246  RegCloseKey(hkey);
2247  return TRUE;
2248 }
DWORD size
Definition: install.c:3645
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3272
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:4041
#define TRUE
Definition: types.h:120
#define HKEY_CURRENT_USER
Definition: winreg.h:11
unsigned char * LPBYTE
Definition: typedefs.h:52
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
DWORD DWORD
Definition: winlogon.h:75
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define FALSE
Definition: types.h:117
HANDLE HKEY
Definition: registry.h:24
#define MAX_PATH
Definition: compat.h:26
static CHAR APP_DATA_DIR[MAX_PATH]
Definition: install.c:68
static void init_functionpointers ( void  )
static

Definition at line 2050 of file install.c.

Referenced by START_TEST().

2051 {
2052  HMODULE hmsi = GetModuleHandleA("msi.dll");
2053  HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
2054  HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
2055 
2056 #define GET_PROC(mod, func) \
2057  p ## func = (void*)GetProcAddress(mod, #func); \
2058  if(!p ## func) \
2059  trace("GetProcAddress(%s) failed\n", #func);
2060 
2064 
2065  GET_PROC(hadvapi32, CheckTokenMembership);
2066  GET_PROC(hadvapi32, ConvertSidToStringSidA);
2067  GET_PROC(hadvapi32, OpenProcessToken);
2068  GET_PROC(hadvapi32, RegDeleteKeyExA)
2069  GET_PROC(hkernel32, IsWow64Process)
2070 
2071  hsrclient = LoadLibraryA("srclient.dll");
2073  GET_PROC(hsrclient, SRSetRestorePointA);
2074 
2075 #undef GET_PROC
2076 }
static HMODULE hsrclient
Definition: install.c:50
INSTALLSTATE WINAPI MsiGetComponentPathExA(LPCSTR product, LPCSTR comp, LPCSTR usersid, MSIINSTALLCONTEXT ctx, LPSTR buf, LPDWORD buflen)
Definition: msi.c:2883
LONG WINAPI RegDeleteKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ REGSAM samDesired, _In_ DWORD Reserved)
Definition: reg.c:1255
static HINSTANCE hkernel32
Definition: process.c:64
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:321
static HMODULE dll
Definition: str.c:188
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:2019
BOOL WINAPI ConvertSidToStringSidA(PSID Sid, LPSTR *StringSid)
Definition: security.c:3303
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:818
BOOL WINAPI SRSetRestorePointA(PRESTOREPOINTINFOA pRestorePtSpec, PSTATEMGRSTATUS pSMgrStatus)
Definition: sfc.c:54
static HMODULE hadvapi32
Definition: lsa.c:40
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:286
HANDLE HMODULE
Definition: typedefs.h:75
#define GET_PROC(mod, func)
UINT WINAPI MsiQueryComponentStateA(LPCSTR szProductCode, LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext, LPCSTR szComponent, INSTALLSTATE *pdwState)
Definition: msi.c:2057
static INSTALLSTATE ( WINAPI pMsiGetComponentPathExA)
static
static BOOL is_process_limited ( void  )
static

Definition at line 2078 of file install.c.

Referenced by test_adminimage(), test_adminprops(), test_allusers_prop(), test_cabisextracted(), test_continuouscabs(), test_currentworkingdir(), test_customaction51(), test_feature_override(), test_feature_tree(), test_file_in_use(), test_file_in_use_cab(), test_icon_table(), test_installed_prop(), test_installstate(), test_missingcab(), test_missingcomponent(), test_mixed_package(), test_mixedmedia(), test_MsiInstallProduct(), test_package_validation(), test_preselected(), test_propcase(), test_readonlyfile(), test_readonlyfile_cab(), test_remove_upgrade_code(), test_setdirproperty(), test_shared_component(), test_shortcut(), test_sourcedirprop(), test_sourcefolder(), test_transformprop(), test_upgrade_code(), and test_volume_props().

2079 {
2081  PSID Group = NULL;
2082  BOOL IsInGroup;
2083  HANDLE token;
2084 
2085  if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE;
2086 
2088  DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
2089  !pCheckTokenMembership(NULL, Group, &IsInGroup))
2090  {
2091  trace("Could not check if the current user is an administrator\n");
2092  FreeSid(Group);
2093  return FALSE;
2094  }
2095  FreeSid(Group);
2096 
2097  if (!IsInGroup)
2098  {
2099  /* Only administrators have enough privileges for these tests */
2100  return TRUE;
2101  }
2102 
2103  if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
2104  {
2105  BOOL ret;
2107  DWORD size;
2108 
2109  ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size);
2110  CloseHandle(token);
2111  return (ret && type == TokenElevationTypeLimited);
2112  }
2113  return FALSE;
2114 }
DWORD size
Definition: install.c:3645
#define trace(...)
Definition: kmt_test.h:172
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
DWORD DWORD
Definition: winlogon.h:75
#define FALSE
Definition: types.h:117
PVOID WINAPI FreeSid(PSID pSid)
Definition: security.c:567
smooth NULL
Definition: ftsmooth.c:557
#define SECURITY_NT_AUTHORITY
Definition: setypes.h:526
int token
Definition: lex.c:57
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SECURITY_BUILTIN_DOMAIN_RID
Definition: setypes.h:553
#define TOKEN_QUERY
Definition: setypes.h:874
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1183
int ret
DWORD *typedef HANDLE
Definition: winlogon.h:52
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:403
#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:543
static LONG ( WINAPI pRegDeleteKeyExA)
static
static void* CDECL mem_alloc ( ULONG  cb)
static

Definition at line 1948 of file install.c.

Referenced by create_cab_file(), and create_cc_test_files().

1949 {
1950  return HeapAlloc(GetProcessHeap(), 0, cb);
1951 }
void UINT cb
Definition: fci.h:175
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static void CDECL mem_free ( void memory)
static

Definition at line 1953 of file install.c.

Referenced by create_cab_file(), and create_cc_test_files().

1954 {
1955  HeapFree(GetProcessHeap(), 0, memory);
1956 }
#define GetProcessHeap()
Definition: compat.h:395
#define HeapFree(x, y, z)
Definition: compat.h:394
static BOOL notify_system_change ( DWORD  event_type,
STATEMGRSTATUS status 
)
static

Definition at line 2512 of file install.c.

Referenced by START_TEST().

2513 {
2514  RESTOREPOINTINFOA spec;
2515 
2516  spec.dwEventType = event_type;
2518  spec.llSequenceNumber = status->llSequenceNumber;
2519  lstrcpyA(spec.szDescription, "msitest restore point");
2520 
2521  return pSRSetRestorePointA(&spec, status);
2522 }
#define APPLICATION_INSTALL
CHAR szDescription[MAX_DESC]
INT64 llSequenceNumber
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
static BOOL pf_exists ( LPCSTR  file)
static

Definition at line 3508 of file install.c.

Referenced by test_feature_override(), test_missingcomponent(), test_shared_component(), and test_upgrade_code().

3509 {
3510  CHAR path[MAX_PATH];
3511 
3512  lstrcpyA(path, PROG_FILES_DIR);
3513  lstrcatA(path, "\\");
3514  lstrcatA(path, file);
3515 
3516  return file_exists(path);
3517 }
char CHAR
Definition: xmlstorage.h:175
static CHAR PROG_FILES_DIR[MAX_PATH]
Definition: install.c:65
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:311
static BOOL file_exists(LPCSTR file)
Definition: install.c:3503
Definition: fci.c:114
static void process_pending_renames ( HKEY  hkey)
static

Definition at line 5151 of file install.c.

Referenced by test_file_in_use(), and test_file_in_use_cab().

5152 {
5153  char *buf, *src, *dst, *buf2, *buf2ptr;
5154  DWORD size;
5155  LONG ret;
5156  BOOL found = FALSE;
5157 
5158  ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, NULL, &size);
5159  ok(!ret, "RegQueryValueExA failed %d\n", ret);
5160 
5161  buf = HeapAlloc(GetProcessHeap(), 0, size + 1);
5162  buf2ptr = buf2 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + 1);
5163 
5164  ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, (LPBYTE)buf, &size);
5165  buf[size] = 0;
5166  ok(!ret, "RegQueryValueExA failed %d\n", ret);
5167  if (ret) return;
5168 
5169  for (src = buf; *src; src = dst + strlen(dst) + 1)
5170  {
5172  BOOL fileret;
5173 
5174  dst = src + strlen(src) + 1;
5175 
5176  if (!strstr(src, "msitest"))
5177  {
5178  lstrcpyA(buf2ptr, src);
5179  buf2ptr += strlen(src) + 1;
5180  lstrcpyA(buf2ptr, dst);
5181  buf2ptr += strlen(dst) + 1;
5182  continue;
5183  }
5184 
5185  found = TRUE;
5186 
5187  if (*dst == '!')
5188  {
5189  flags |= MOVEFILE_REPLACE_EXISTING;
5190  dst++;
5191  }
5192  if (src[0] == '\\' && src[1] == '?' && src[2] == '?' && src[3] == '\\') src += 4;
5193  if (*dst)
5194  {
5195  if (dst[0] == '\\' && dst[1] == '?' && dst[2] == '?' && dst[3] == '\\') dst += 4;
5196  fileret = MoveFileExA(src, dst, flags);
5197  ok(fileret, "Failed to move file %s -> %s (%u)\n", src, dst, GetLastError());
5198  }
5199  else
5200  {
5201  fileret = DeleteFileA(src);
5202  ok(fileret || broken(!fileret) /* win2k3 */, "Failed to delete file %s (%u)\n", src, GetLastError());
5203  }
5204  }
5205 
5206  ok(found, "Expected a 'msitest' entry\n");
5207 
5208  if (*buf2)
5209  RegSetValueExA(hkey, rename_ops, 0, REG_MULTI_SZ, (LPBYTE)buf2, buf2ptr + 1 - buf2);
5210  else
5211  RegDeleteValueA(hkey, rename_ops);
5212 
5213  HeapFree(GetProcessHeap(), 0, buf);
5214  HeapFree(GetProcessHeap(), 0, buf2);
5215 }
DWORD size
Definition: install.c:3645
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:4041
BOOL WINAPI MoveFileExA(IN LPCSTR lpExistingFileName, IN LPCSTR lpNewFileName OPTIONAL, IN DWORD dwFlags)
Definition: move.c:1093
#define TRUE
Definition: types.h:120
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
unsigned char * LPBYTE
Definition: typedefs.h:52
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
DWORD DWORD
Definition: winlogon.h:75
GLuint const GLubyte GLvoid * src
Definition: s_context.h:57
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
#define REG_MULTI_SZ
Definition: nt_native.h:1501
smooth NULL
Definition: ftsmooth.c:557
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define MOVEFILE_COPY_ALLOWED
Definition: winbase.h:371
static const char rename_ops[]
Definition: install.c:5149
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
GLbitfield flags
Definition: glext.h:7161
int ret
#define broken(x)
Definition: _sntprintf.h:21
LONG WINAPI RegDeleteValueA(HKEY hKey, LPCSTR lpValueName)
Definition: reg.c:2331
GLuint const GLubyte GLvoid const GLvoid * dst
Definition: s_context.h:57
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define ok(value,...)
Definition: CImage.cpp:33
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4831
#define HeapFree(x, y, z)
Definition: compat.h:394
#define MOVEFILE_REPLACE_EXISTING
Definition: winbase.h:370
static LONG CDECL progress ( UINT  typeStatus,
ULONG  cb1,
ULONG  cb2,
void pv 
)
static

Definition at line 1964 of file install.c.

Referenced by add_file(), create_cab_file(), and create_cc_test_files().

1965 {
1966  return 0;
1967 }
static void remove_restore_point ( DWORD  seq_number)
static

Definition at line 2524 of file install.c.

Referenced by START_TEST().

2525 {
2526  DWORD res;
2527 
2528  res = pSRRemoveRestorePoint(seq_number);
2529  if (res != ERROR_SUCCESS)
2530  trace("Failed to remove the restore point : %08x\n", res);
2531 }
#define trace(...)
Definition: kmt_test.h:172
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD DWORD
Definition: winlogon.h:75
GLuint res
Definition: glext.h:9613
static UINT run_query ( MSIHANDLE  hdb,
MSIHANDLE  hrec,
const char query 
)
static

Definition at line 3541 of file install.c.

Referenced by generate_transform(), and test_icon_table().

3542 {
3543  MSIHANDLE hview = 0;
3544  UINT r;
3545 
3546  r = MsiDatabaseOpenViewA(hdb, query, &hview);
3547  if(r != ERROR_SUCCESS)
3548  return r;
3549 
3550  r = MsiViewExecute(hview, hrec);
3551  if(r == ERROR_SUCCESS)
3552  r = MsiViewClose(hview);
3553  MsiCloseHandle(hview);
3554  return r;
3555 }
UINT WINAPI MsiViewExecute(MSIHANDLE hView, MSIHANDLE hRec)
Definition: msiquery.c:440
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
UINT WINAPI MsiDatabaseOpenViewA(MSIHANDLE hdb, LPCSTR szQuery, MSIHANDLE *phView)
Definition: msiquery.c:69
unsigned long MSIHANDLE
Definition: msiserver.idl:25
UINT WINAPI MsiViewClose(MSIHANDLE hView)
Definition: msiquery.c:408
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:259
unsigned int UINT
Definition: ndis.h:50
static void set_admin_property_stream ( LPCSTR  file)
static

Definition at line 3876 of file install.c.

Referenced by test_adminprops().

3877 {
3878  IStorage *stg;
3879  IStream *stm;
3880  WCHAR fileW[MAX_PATH];
3881  HRESULT hr;
3882  DWORD count;
3884 
3885  /* AdminProperties */
3886  static const WCHAR stmname[] = {0x41ca,0x4330,0x3e71,0x44b5,0x4233,0x45f5,0x422c,0x4836,0};
3887  static const WCHAR data[] = {'M','Y','P','R','O','P','=','2','7','1','8',' ',
3888  'M','y','P','r','o','p','=','4','2',0};
3889 
3890  MultiByteToWideChar(CP_ACP, 0, file, -1, fileW, MAX_PATH);
3891 
3892  hr = StgOpenStorage(fileW, NULL, mode, NULL, 0, &stg);
3893  ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
3894  if (!stg)
3895  return;
3896 
3897  hr = IStorage_CreateStream(stg, stmname, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
3898  ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
3899 
3900  hr = IStream_Write(stm, data, sizeof(data), &count);
3901  ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
3902 
3903  IStream_Release(stm);
3904  IStorage_Release(stg);
3905 }
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:922
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CP_ACP
Definition: compat.h:99
DWORD DWORD
Definition: winlogon.h:75
smooth NULL
Definition: ftsmooth.c:557
#define STGM_WRITE
Definition: objbase.h:917
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI StgOpenStorage(const OLECHAR *pwcsName, IStorage *pstgPriority, DWORD grfMode, SNB snbExclude, DWORD reserved, IStorage **ppstgOpen)
Definition: storage32.c:8736
#define STGM_DIRECT
Definition: objbase.h:913
#define MAX_PATH
Definition: compat.h:26
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define STGM_READWRITE
Definition: objbase.h:918
#define S_OK
Definition: intsafe.h:59
#define MultiByteToWideChar
Definition: compat.h:100
#define ok(value,...)
Definition: CImage.cpp:33
static const WCHAR fileW[]
Definition: url.c:96
Definition: fci.c:114
static void set_admin_summary_info ( const WCHAR name)
static

Definition at line 3810 of file install.c.

Referenced by test_admin(), and test_adminprops().

3811 {
3812  MSIHANDLE db, summary;
3813  UINT r;
3814 
3816  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3817 
3818  r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
3819  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3820 
3822  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3823 
3824  /* write the summary changes back to the stream */
3825  r = MsiSummaryInfoPersist(summary);
3826  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3827 
3828  MsiCloseHandle(summary);
3829 
3830  r = MsiDatabaseCommit(db);
3831  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3832 
3833  MsiCloseHandle(db);
3834 }
Definition: compat.h:1932
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define MSIDBOPEN_DIRECT
Definition: msiquery.h:68
unsigned long MSIHANDLE
Definition: msiserver.idl:25
UINT WINAPI MsiSummaryInfoSetPropertyA(MSIHANDLE handle, UINT uiProperty, UINT uiDataType, INT iValue, FILETIME *pftValue, LPCSTR szValue)
Definition: suminfo.c:833
smooth NULL
Definition: ftsmooth.c:557
UINT WINAPI MsiGetSummaryInformationA(MSIHANDLE hDatabase, LPCSTR szDatabase, UINT uiUpdateCount, MSIHANDLE *pHandle)
Definition: suminfo.c:556
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:259
UINT WINAPI MsiDatabaseCommit(MSIHANDLE hdb)
Definition: msiquery.c:794
UINT WINAPI MsiOpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIHANDLE *phDB)
Definition: database.c:286
unsigned int UINT
Definition: ndis.h:50
UINT WINAPI MsiSummaryInfoPersist(MSIHANDLE handle)
Definition: suminfo.c:1114
#define PID_WORDCOUNT
Definition: suminfo.c:57
Definition: name.c:23
#define ok(value,...)
Definition: CImage.cpp:33
static void set_cab_parameters ( PCCAB  pCabParams,
const CHAR name,
DWORD  max_size 
)
static

Definition at line 2187 of file install.c.

Referenced by create_cab_file(), and create_cc_test_files().

2188 {
2189  ZeroMemory(pCabParams, sizeof(CCAB));
2190 
2191  pCabParams->cb = max_size;
2192  pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
2193  pCabParams->setID = 0xbeef;
2194  pCabParams->iCab = 1;
2195  lstrcpyA(pCabParams->szCabPath, CURR_DIR);
2196  lstrcatA(pCabParams->szCabPath, "\\");
2197  lstrcpyA(pCabParams->szCab, name);
2198 }
ULONG cbFolderThresh
Definition: fci.h:146
#define ZeroMemory
Definition: winbase.h:1621
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
static CHAR CURR_DIR[MAX_PATH]
Definition: install.c:64
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:23
char szCabPath[CB_MAX_CAB_PATH]
Definition: fci.h:161
#define FOLDER_THRESHOLD
Definition: install.c:1944
static void set_transform_summary_info ( void  )
static

Definition at line 3557 of file install.c.

Referenced by generate_transform_manual().

3558 {
3559  UINT r;
3560  MSIHANDLE suminfo = 0;
3561 
3562  /* build summary info */
3563  r = MsiGetSummaryInformationA(0, mstfile, 3, &suminfo);
3564  ok(r == ERROR_SUCCESS , "Failed to open summaryinfo\n");
3565 
3566  r = MsiSummaryInfoSetPropertyA(suminfo, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
3567  ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
3568 
3570  "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
3571  "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
3572  "{4C0EAA15-0264-4E5A-8758-609EF142B92D}");
3573  ok(r == ERROR_SUCCESS , "Failed to set summary info\n");
3574 
3575  r = MsiSummaryInfoSetPropertyA(suminfo, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
3576  ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
3577 
3578  r = MsiSummaryInfoPersist(suminfo);
3579  ok(r == ERROR_SUCCESS , "Failed to make summary info persist\n");
3580 
3581  r = MsiCloseHandle(suminfo);
3582  ok(r == ERROR_SUCCESS , "Failed to close suminfo\n");
3583 }
Definition: compat.h:1932
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define PID_REVNUMBER
Definition: suminfo.c:51
unsigned long MSIHANDLE
Definition: msiserver.idl:25
static const CHAR suminfo[]
Definition: db.c:2199
UINT WINAPI MsiSummaryInfoSetPropertyA(MSIHANDLE handle, UINT uiProperty, UINT uiDataType, INT iValue, FILETIME *pftValue, LPCSTR szValue)
Definition: suminfo.c:833
smooth NULL
Definition: ftsmooth.c:557
#define PID_PAGECOUNT
Definition: suminfo.c:56
#define PID_TITLE
Definition: suminfo.c:44
UINT WINAPI MsiGetSummaryInformationA(MSIHANDLE hDatabase, LPCSTR szDatabase, UINT uiUpdateCount, MSIHANDLE *pHandle)
Definition: suminfo.c:556
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:259
unsigned int UINT
Definition: ndis.h:50
UINT WINAPI MsiSummaryInfoPersist(MSIHANDLE handle)
Definition: suminfo.c:1114
#define ok(value,...)
Definition: CImage.cpp:33
static const char * mstfile
Definition: install.c:59
START_TEST ( install  )

Definition at line 6046 of file install.c.

6047 {
6048  DWORD len;
6049  char temp_path[MAX_PATH], prev_path[MAX_PATH], log_file[MAX_PATH];
6051  BOOL ret = FALSE;
6052 
6054 
6055  if (pIsWow64Process)
6056  pIsWow64Process(GetCurrentProcess(), &is_wow64);
6057 
6058  GetCurrentDirectoryA(MAX_PATH, prev_path);
6059  GetTempPathA(MAX_PATH, temp_path);
6060  SetCurrentDirectoryA(temp_path);
6061 
6062  lstrcpyA(CURR_DIR, temp_path);
6063  len = lstrlenA(CURR_DIR);
6064 
6065  if(len && (CURR_DIR[len - 1] == '\\'))
6066  CURR_DIR[len - 1] = 0;
6067 
6068  ok(get_system_dirs(), "failed to retrieve system dirs\n");
6069  ok(get_user_dirs(), "failed to retrieve user dirs\n");
6070 
6071  /* Create a restore point ourselves so we circumvent the multitude of restore points
6072  * that would have been created by all the installation and removal tests.
6073  *
6074  * This is not needed on version 5.0 where setting MSIFASTINSTALL prevents the
6075  * creation of restore points.
6076  */
6077  if (pSRSetRestorePointA && !pMsiGetComponentPathExA)
6078  {
6079  memset(&status, 0, sizeof(status));
6081  }
6082 
6083  /* Create only one log file and don't append. We have to pass something
6084  * for the log mode for this to work. The logfile needs to have an absolute
6085  * path otherwise we still end up with some extra logfiles as some tests
6086  * change the current directory.
6087  */
6088  lstrcpyA(log_file, temp_path);
6089  lstrcatA(log_file, "\\msitest.log");
6091 
6092  if (pSRSetRestorePointA) /* test has side-effects on win2k3 that cause failures in following tests */
6097  test_caborder();
6098  test_mixedmedia();
6107  test_admin();
6108  test_adminprops();
6109  test_missingcab();
6113  test_sourcepath();
6116  test_adminimage();
6117  test_propcase();
6118  test_int_widths();
6119  test_shortcut();
6120  test_preselected();
6122  test_file_in_use();
6126  test_icon_table();
6134 
6135  DeleteFileA(log_file);
6136 
6137  if (pSRSetRestorePointA && !pMsiGetComponentPathExA && ret)
6138  {
6140  if (ret)
6142  }
6144 
6145  SetCurrentDirectoryA(prev_path);
6146 }
static void test_currentworkingdir(void)
Definition: install.c:3744
static void test_mixed_package(void)
Definition: install.c:5743
static void test_cabisextracted(void)
Definition: install.c:3455
static HMODULE hsrclient
Definition: install.c:50
static void test_propcase(void)
Definition: install.c:4767
static void test_missingcomponent(void)
Definition: install.c:4593
static void test_adminprops(void)
Definition: install.c:3907
static void init_functionpointers(void)
Definition: install.c:2050
static void test_upgrade_code(void)
Definition: install.c:5711
static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
Definition: install.c:2512
static void test_caborder(void)
Definition: install.c:3110
static void test_installstate(void)
Definition: install.c:4107
static BOOL get_system_dirs(void)
Definition: install.c:2250
DWORD DWORD
Definition: winlogon.h:75
static void test_continuouscabs(void)
Definition: install.c:3003
static void test_readonlyfile_cab(void)
Definition: install.c:3361
static void test_sourcefolder(void)
Definition: install.c:4028
static void test_missingcab(void)
Definition: install.c:3958
static void test_customaction51(void)
Definition: install.c:4074
#define FALSE
Definition: types.h:117
static void test_adminimage(void)
Definition: install.c:4700
static void test_int_widths(void)
Definition: install.c:4810
#define END_NESTED_SYSTEM_CHANGE
static void test_installed_prop(void)
Definition: install.c:4993
static void test_transformprop(void)
Definition: install.c:3698
static void test_allusers_prop(void)
Definition: install.c:5044
static CHAR CURR_DIR[MAX_PATH]
Definition: install.c:64
static BOOL get_user_dirs(void)
Definition: install.c:2231
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
static void test_setdirproperty(void)
Definition: install.c:3422
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
#define BEGIN_NESTED_SYSTEM_CHANGE
#define FreeLibrary(x)
Definition: compat.h:405
unsigned int BOOL
Definition: ntddk_ex.h:94
static void test_feature_tree(void)
Definition: install.c:6017
INT64 llSequenceNumber
static STATEMGRSTATUS *static BOOL is_wow64
Definition: install.c:52
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1183
static void test_icon_table(void)
Definition: install.c:5438
#define MAX_PATH
Definition: compat.h:26
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
static void test_readonlyfile(void)
Definition: install.c:3313
static void test_file_in_use_cab(void)
Definition: install.c:5294
static void test_feature_override(void)
Definition: install.c:5357
int ret
static void test_sourcedirprop(void)
Definition: install.c:4648
static void test_preselected(void)
Definition: install.c:4936
static void remove_restore_point(DWORD seq_number)
Definition: install.c:2524
BOOL WINAPI SetCurrentDirectoryA(IN LPCSTR lpPathName)
Definition: path.c:2206
static void test_mixedmedia(void)
Definition: install.c:3196
GLenum GLsizei len
Definition: glext.h:6722
static void test_volume_props(void)
Definition: install.c:5896
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2054
static void test_samesequence(void)
Definition: install.c:3239
static void test_sourcepath(void)
Definition: install.c:4512
static void test_file_in_use(void)
Definition: install.c:5235
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2146
static void test_uiLevelFlags(void)
Definition: install.c:3268
static void test_packagecoltypes(void)
Definition: install.c:2887
static void test_MsiSetComponentState(void)
Definition: install.c:2838
static void test_remove_upgrade_code(void)
Definition: install.c:5966
#define ok(value,...)
Definition: CImage.cpp:33
static void test_MsiInstallProduct(void)
Definition: install.c:2540
#define memset(x, y, z)
Definition: compat.h:39
static void test_shared_component(void)
Definition: install.c:5922
static SERVICE_STATUS status
Definition: service.c:26
static void test_admin(void)
Definition: install.c:3836
UNICODE_STRING log_file
Definition: btrfs.c:83
static void test_shortcut(void)
Definition: install.c:4877
UINT WINAPI MsiEnableLogA(DWORD dwLogMode, LPCSTR szLogFile, DWORD attributes)
Definition: msi.c:1884
static void test_package_validation(void)
Definition: install.c:5520
static void test_admin ( void  )
static

Definition at line 3836 of file install.c.

Referenced by START_TEST().

3837 {
3838  UINT r;
3839 
3840  CreateDirectoryA("msitest", NULL);
3841  create_file("msitest\\augustus", 500);
3842 
3843  create_database(msifile, adm_tables, sizeof(adm_tables) / sizeof(msi_table));
3845 
3847 
3850  {
3851  skip("Not enough rights to perform tests\n");
3852  goto error;
3853  }
3854  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3855  ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3856  ok(!delete_pf("msitest", FALSE), "Directory created\n");
3857  ok(!DeleteFileA("c:\\msitest\\augustus"), "File installed\n");
3858  ok(!RemoveDirectoryA("c:\\msitest"), "File installed\n");
3859 
3860  r = MsiInstallProductA(msifile, "ACTION=ADMIN");
3861  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3862  ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3863  ok(!delete_pf("msitest", FALSE), "Directory created\n");
3864  todo_wine
3865  {
3866  ok(DeleteFileA("c:\\msitest\\augustus"), "File not installed\n");
3867  ok(RemoveDirectoryA("c:\\msitest"), "File not installed\n");
3868  }
3869 
3870 error:
3872  DeleteFileA("msitest\\augustus");
3873  RemoveDirectoryA("msitest");
3874 }
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define TRUE
Definition: types.h:120
static const WCHAR msifileW[]
Definition: install.c:61
#define ERROR_SUCCESS
Definition: deptool.c:10
static const char * msifile
Definition: install.c:57
#define error(str)
Definition: mkdosfs.c:1605
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:181
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2289
#define create_database(name, tables, num_tables)
Definition: install.c:2448
#define create_file(name, size)
Definition: install.c:2306
#define FALSE
Definition: types.h:117
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
smooth NULL
Definition: ftsmooth.c:557
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
static const msi_table adm_tables[]
Definition: install.c:1612
#define todo_wine
Definition: test.h:154
static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
Definition: install.c:2328
#define skip(...)
Definition: CString.cpp:57
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
unsigned int UINT
Definition: ndis.h:50
#define ok(value,...)
Definition: CImage.cpp:33
static void set_admin_summary_info(const WCHAR *name)
Definition: install.c:3810
static void test_adminimage ( void  )
static

Definition at line 4700 of file install.c.

Referenced by START_TEST().

4701 {
4702  UINT r;
4703 
4704  if (is_process_limited())
4705  {
4706  skip("process is limited\n");
4707  return;
4708  }
4709 
4710  CreateDirectoryA("msitest", NULL);
4711  CreateDirectoryA("msitest\\first", NULL);
4712  CreateDirectoryA("msitest\\second", NULL);
4713  CreateDirectoryA("msitest\\cabout", NULL);
4714  CreateDirectoryA("msitest\\cabout\\new", NULL);
4715  create_file("msitest\\one.txt", 100);
4716  create_file("msitest\\first\\two.txt", 100);
4717  create_file("msitest\\second\\three.txt", 100);
4718  create_file("msitest\\cabout\\four.txt", 100);
4719  create_file("msitest\\cabout\\new\\five.txt", 100);
4720  create_file("msitest\\filename", 100);
4721  create_file("msitest\\service.exe", 100);
4722 
4724  sizeof(ai_tables) / sizeof(msi_table),
4725  100, msidbSumInfoSourceTypeAdminImage, ";1033",
4726  "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
4727 
4729 
4732  {
4733  skip("Not enough rights to perform tests\n");
4734  goto error;
4735  }
4736  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4737 
4738  ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
4739  ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
4740  ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
4741  ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
4742  ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
4743  ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
4744  ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
4745  ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
4746  ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
4747  ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
4748  ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
4749  ok(delete_pf("msitest", FALSE), "Directory not created\n");
4750 
4751 error:
4752  DeleteFileA("msifile");
4753  DeleteFileA("msitest\\cabout\\new\\five.txt");
4754  DeleteFileA("msitest\\cabout\\four.txt");
4755  DeleteFileA("msitest\\second\\three.txt");
4756  DeleteFileA("msitest\\first\\two.txt");
4757  DeleteFileA("msitest\\one.txt");
4758  DeleteFileA("msitest\\service.exe");
4759  DeleteFileA("msitest\\filename");
4760  RemoveDirectoryA("msitest\\cabout\\new");
4761  RemoveDirectoryA("msitest\\cabout");
4762  RemoveDirectoryA("msitest\\second");
4763  RemoveDirectoryA("msitest\\first");
4764  RemoveDirectoryA("msitest");
4765 }
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
static const char * msifile
Definition: install.c:57
#define error(str)
Definition: mkdosfs.c:1605
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:181
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2289
#define create_file(name, size)
Definition: install.c:2306
#define FALSE
Definition: types.h:117
static const msi_table ai_tables[]
Definition: install.c:1712
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
smooth NULL
Definition: ftsmooth.c:557
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
static void create_database_wordcount(const CHAR *name, const msi_table *tables, int num_tables, INT version, INT wordcount, const char *template, const char *packagecode)
Definition: install.c:2456
static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
Definition: install.c:2328
#define skip(...)
Definition: CString.cpp:57
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
unsigned int UINT
Definition: ndis.h:50
#define ok(value,...)
Definition: CImage.cpp:33
static BOOL is_process_limited(void)
Definition: install.c:2078
static void test_adminprops ( void  )
static

Definition at line 3907 of file install.c.

Referenced by START_TEST().

3908 {
3909  UINT r;
3910 
3911  if (is_process_limited())
3912  {
3913  skip("process is limited\n");
3914  return;
3915  }
3916 
3917  CreateDirectoryA("msitest", NULL);
3918  create_file("msitest\\augustus", 500);
3919 
3920  create_database(msifile, amp_tables, sizeof(amp_tables) / sizeof(msi_table));
3923 
3925 
3928  {
3929  skip("Not enough rights to perform tests\n");
3930  goto error;
3931  }
3932  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3933  ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
3934  ok(delete_pf("msitest", FALSE), "Directory created\n");
3935 
3936 error:
3938  DeleteFileA("msitest\\augustus");
3939  RemoveDirectoryA("msitest");
3940 }
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define TRUE
Definition: types.h:120
static const WCHAR msifileW[]
Definition: install.c:61
#define ERROR_SUCCESS
Definition: deptool.c:10
static const char * msifile
Definition: install.c:57
#define error(str)
Definition: mkdosfs.c:1605
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:181
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2289
#define create_database(name, tables, num_tables)
Definition: install.c:2448
#define create_file(name, size)
Definition: install.c:2306
#define FALSE
Definition: types.h:117
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
smooth NULL
Definition: ftsmooth.c:557
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
static const msi_table amp_tables[]
Definition: install.c:1626
static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
Definition: install.c:2328
#define skip(...)
Definition: CString.cpp:57
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
unsigned int UINT
Definition: ndis.h:50
#define ok(value,...)
Definition: CImage.cpp:33
static BOOL is_process_limited(void)
Definition: install.c:2078
static void set_admin_summary_info(const WCHAR *name)
Definition: install.c:3810
static void set_admin_property_stream(LPCSTR file)
Definition: install.c:3876
static void test_allusers_prop ( void  )
static

Definition at line 5044 of file install.c.

Referenced by START_TEST().

5045 {
5046  UINT r;
5047 
5048  if (is_process_limited())
5049  {
5050  skip("process is limited\n");
5051  return;
5052  }
5053 
5055  create_database(msifile, aup_tables, sizeof(aup_tables) / sizeof(msi_table));
5056 
5058 
5059  /* ALLUSERS property unset */
5060  r = MsiInstallProductA(msifile, "FULL=1");
5062  {
5063  skip("Not enough rights to perform tests\n");
5064  goto error;
5065  }
5066  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5067 
5068  ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5069  ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5070  ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5071  ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5072  ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5073  ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5074  ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5075  ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5076  ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5077  ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
5078  ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5079  ok(delete_pf("msitest", FALSE), "Directory not created\n");
5080 
5081  r = MsiInstallProductA(msifile, "REMOVE=ALL");
5082  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5083 
5085 
5088 
5089  /* ALLUSERS property set to 1 */
5090  r = MsiInstallProductA(msifile, "FULL=1");
5091  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5092 
5093  ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5094  ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5095  ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5096  ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5097  ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5098  ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5099  ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5100  ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5101  ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5102  ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
5103  ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5104  ok(delete_pf("msitest", FALSE), "Directory not created\n");
5105 
5106  r = MsiInstallProductA(msifile, "REMOVE=ALL");
5107  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5108 
5110 
5113 
5114  /* ALLUSERS property set to 2 */
5115  r = MsiInstallProductA(msifile, "FULL=1");
5116  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5117 
5118  ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5119  ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5120  ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5121  ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5122  ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5123  ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5124  ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5125  ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5126  ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5127  ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
5128  ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5129  ok(delete_pf("msitest", FALSE), "Directory not created\n");
5130 
5131  r = MsiInstallProductA(msifile, "REMOVE=ALL");
5132  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5133 
5135 
5138 
5139  /* ALLUSERS property set to 2, conditioned on ALLUSERS = 1 */
5140  r = MsiInstallProductA(msifile, "FULL=1");
5141  ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5142 
5143 error:
5146 }
static void delete_test_files(void)
Definition: install.c:2393
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
static const char * msifile
Definition: install.c:57
#define error(str)
Definition: mkdosfs.c:1605
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:181
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2289
#define create_database(name, tables, num_tables)
Definition: install.c:2448
static const msi_table aup3_tables[]
Definition: install.c:1775
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:557
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
static const msi_table aup2_tables[]
Definition: install.c:1762
#define ERROR_INSTALL_FAILURE
Definition: winerror.h:961
static const msi_table aup4_tables[]
Definition: install.c:1788
static void create_test_files(void)
Definition: install.c:2308
static const msi_table aup_tables[]
Definition: install.c:1749
static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
Definition: install.c:2328
#define skip(...)
Definition: CString.cpp:57
unsigned int UINT
Definition: ndis.h:50
#define ok(value,...)
Definition: CImage.cpp:33
static BOOL is_process_limited(void)
Definition: install.c:2078
static void test_cabisextracted ( void  )
static

Definition at line 3455 of file install.c.

Referenced by START_TEST().

3456 {
3457  UINT r;
3458 
3459  if (is_process_limited())
3460  {
3461  skip("process is limited\n");
3462  return;
3463  }
3464 
3465  CreateDirectoryA("msitest", NULL);
3466  create_file("msitest\\gaius", 500);
3467  create_file("maximus", 500);
3468  create_file("augustus", 500);
3469  create_file("caesar", 500);
3470 
3471  create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3472  create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
3473  create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3474 
3475  create_database(msifile, cie_tables, sizeof(cie_tables) / sizeof(msi_table));
3476 
3478 
3481  {
3482  skip("Not enough rights to perform tests\n");
3483  goto error;
3484  }
3485  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3486  ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3487  ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3488  ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3489  ok(delete_pf("msitest\\gaius", TRUE), "File not installed\n");
3490  ok(delete_pf("msitest", FALSE), "Directory not created\n");
3491 
3492 error:
3493  /* Delete the files in the temp (current) folder */
3494  delete_cab_files();
3496  DeleteFileA("maximus");
3497  DeleteFileA("augustus");
3498  DeleteFileA("caesar");
3499  DeleteFileA("msitest\\gaius");
3500  RemoveDirectoryA("msitest");
3501 }
#define MEDIA_SIZE
Definition: install.c:1943
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
static const char * msifile
Definition: install.c:57
#define error(str)
Definition: mkdosfs.c:1605
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:181
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static const msi_table cie_tables[]
Definition: install.c:1576
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2289
static void delete_cab_files(void)
Definition: install.c:2985
#define create_database(name, tables, num_tables)
Definition: install.c:2448
#define create_file(name, size)
Definition: install.c:2306
#define FALSE
Definition: types.h:117
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
smooth NULL
Definition: ftsmooth.c:557
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
Definition: install.c:2328
#define skip(...)
Definition: CString.cpp:57
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
unsigned int UINT
Definition: ndis.h:50
#define ok(value,...)
Definition: CImage.cpp:33
static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
Definition: install.c:2200
static BOOL is_process_limited(void)
Definition: install.c:2078
static void test_caborder ( void  )
static

Definition at line 3110 of file install.c.

Referenced by START_TEST().

3111 {
3112  UINT r;
3113 
3114  create_file("imperator", 100);
3115  create_file("maximus", 500);
3116  create_file("augustus", 50000);
3117  create_file("caesar", 500);
3118 
3119  create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
3120 
3122 
3123  create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3124  create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
3125  create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3126 
3129  {
3130  skip("Not enough rights to perform tests\n");
3131  goto error;
3132  }
3133  ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3134  ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3135  ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3136  todo_wine
3137  {
3138  ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3139  ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3140  }
3141 
3142  delete_cab_files();
3143 
3144  create_cab_file("test1.cab", MEDIA_SIZE, "imperator\0");
3145  create_cab_file("test2.cab", MEDIA_SIZE, "maximus\0augustus\0");
3146  create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3147 
3149  ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3150  ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3151  ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3152  ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3153  ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3154 
3155  delete_cab_files();
3157 
3159  create_database(msifile, co_tables, sizeof(co_tables) / sizeof(msi_table));
3160 
3162  ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3163  ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3164  ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3165  todo_wine
3166  {
3167  ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3168  ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3169  }
3170 
3171  delete_cab_files();</