ReactOS  0.4.10-dev-509-g12e8d7f
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 <winsvc.h>
#include <shellapi.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 delete_pf_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 charload_resource (const char *name)
 
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 add_custom_dll (void)
 
static INT CALLBACK ok_callback (void *context, UINT message_type, MSIHANDLE record)
 
static void test_customaction1 (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)
 
static void check_file_matches (const char *filename, const char *text)
 
static void test_deferred_action (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 charcustomdll
 
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 ca1_install_exec_seq_dat []
 
static const CHAR ca1_custom_action_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 char da_custom_action_dat []
 
static const char da_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 ca1_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 msi_table da_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 1330 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:1332
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:2529
Definition: name.c:36

Definition at line 2525 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 3943 of file install.c.

Referenced by test_missingcab().

#define FOLDER_THRESHOLD   900000

Definition at line 2001 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:217
if(!(yy_init))
Definition: macro.lex.yy.c:717
#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 3639 of file install.c.

Referenced by generate_transform_manual().

Typedef Documentation

Function Documentation

static void add_custom_dll ( void  )
static

Definition at line 4061 of file install.c.

Referenced by test_customaction1(), and test_deferred_action().

4062 {
4063  MSIHANDLE hdb = 0, record;
4064  UINT res;
4065 
4067  ok(res == ERROR_SUCCESS, "failed to open db: %u\n", res);
4068 
4069  res = run_query(hdb, 0, "CREATE TABLE `Binary` (`Name` CHAR(72) NOT NULL, `Data` OBJECT NOT NULL PRIMARY KEY `Name`)");
4070  ok(res == ERROR_SUCCESS, "failed to create Binary table: %u\n", res);
4071 
4072  record = MsiCreateRecord(1);
4074  ok(res == ERROR_SUCCESS, "failed to add %s to stream: %u\n", customdll, res);
4075 
4076  res = run_query(hdb, record, "INSERT INTO `Binary` (`Name`, `Data`) VALUES ('custom.dll', ?)");
4077  ok(res == ERROR_SUCCESS, "failed to insert into Binary table: %u\n", res);
4078 
4079  res = MsiDatabaseCommit(hdb);
4080  ok(res == ERROR_SUCCESS, "failed to commit database: %u\n", res);
4081 
4083  MsiCloseHandle(hdb);
4084 }
MSIHANDLE WINAPI MsiCreateRecord(UINT cParams)
Definition: record.c:95
static const WCHAR msifileW[]
Definition: install.c:63
#define ERROR_SUCCESS
Definition: deptool.c:10
UINT WINAPI MsiRecordSetStreamA(MSIHANDLE hRecord, UINT iField, LPCSTR szFilename)
Definition: record.c:777
unsigned long MSIHANDLE
Definition: msiserver.idl:25
static const char * customdll
Definition: install.c:73
#define ok(value,...)
Definition: CComObject.cpp:34
#define MSIDBOPEN_TRANSACT
Definition: msiquery.h:67
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
static UINT run_query(MSIHANDLE hdb, MSIHANDLE hrec, const char *query)
Definition: install.c:3527
UINT WINAPI MsiDatabaseCommit(MSIHANDLE hdb)
Definition: msiquery.c:813
UINT WINAPI MsiOpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIHANDLE *phDB)
Definition: database.c:303
unsigned int UINT
Definition: ndis.h:50
GLuint res
Definition: glext.h:9613
static BOOL add_file ( HFCI  hfci,
const char file,
TCOMP  compress 
)
static

Definition at line 2229 of file install.c.

Referenced by create_cab_file(), and create_cc_test_files().

2230 {
2231  char path[MAX_PATH];
2232  char filename[MAX_PATH];
2233 
2234  lstrcpyA(path, CURR_DIR);
2235  lstrcatA(path, "\\");
2236  lstrcatA(path, file);
2237 
2238  lstrcpyA(filename, file);
2239 
2240  return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet,
2242 }
const char * filename
Definition: ioapi.h:135
#define FALSE
Definition: types.h:117
static CHAR CURR_DIR[MAX_PATH]
Definition: install.c:66
static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime, USHORT *pattribs, int *err, void *pv)
Definition: install.c:2203
static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
Definition: install.c:2015
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
Definition: compress.c:68
#define MAX_PATH
Definition: compat.h:26
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
Definition: services.c:325
static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
Definition: install.c:2021
BOOL __cdecl FCIAddFile(HFCI hfci, char *pszSourceFile, char *pszFileName, BOOL fExecute, PFNFCIGETNEXTCABINET pfnfcignc, PFNFCISTATUS pfnfcis, PFNFCIGETOPENINFO pfnfcigoi, TCOMP typeCompress)
Definition: fci.c:1397
Definition: fci.c:126
static BOOL ( WINAPI pCheckTokenMembership)
static

Referenced by do_register_dll().

static void check_file_matches ( const char filename,
const char text 
)
static

Definition at line 6045 of file install.c.

Referenced by test_deferred_action().

6046 {
6047  char buffer[200];
6048  HANDLE file;
6049  DWORD size;
6050 
6052  ReadFile(file, buffer, sizeof(buffer), &size, NULL);
6053  ok(size == strlen(text) && !memcmp(buffer, text, size), "got %.*s\n", size, buffer);
6054  CloseHandle(file);
6055 }
DWORD size
Definition: install.c:3631
#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
const WCHAR * text
Definition: package.c:1827
GLuint buffer
Definition: glext.h:5915
const char * filename
Definition: ioapi.h:135
DWORD DWORD
Definition: winlogon.h:83
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:426
#define ok(value,...)
Definition: CComObject.cpp:34
const char file[]
Definition: icontest.c:11
#define GENERIC_READ
Definition: compat.h:124
DWORD *typedef HANDLE
Definition: winlogon.h:60
#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 check_record ( MSIHANDLE  rec,
UINT  field,
LPCSTR  val 
)
static

Definition at line 2173 of file install.c.

Referenced by test_packagecoltypes().

2174 {
2175  CHAR buffer[0x20];
2176  UINT r;
2177  DWORD sz;
2178 
2179  sz = sizeof buffer;
2180  r = MsiRecordGetStringA(rec, field, buffer, &sz);
2181  return (r == ERROR_SUCCESS ) && !strcmp(val, buffer);
2182 }
#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:451
DWORD DWORD
Definition: winlogon.h:83
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 2567 of file install.c.

Referenced by test_MsiInstallProduct().

2568 {
2569  SC_HANDLE scm, service;
2570  BOOL res;
2571 
2573  ok(scm != NULL, "Failed to open the SC Manager\n");
2574 
2575  service = OpenServiceA(scm, "TestService", SC_MANAGER_ALL_ACCESS);
2576  ok(service != NULL, "Failed to open TestService\n");
2577 
2578  res = DeleteService(service);
2579  ok(res, "Failed to delete TestService\n");
2580 
2581  CloseServiceHandle(service);
2582  CloseServiceHandle(scm);
2583 }
BOOL WINAPI DeleteService(SC_HANDLE hService)
Definition: scm.c:782
SC_HANDLE WINAPI OpenSCManagerA(LPCSTR lpMachineName, LPCSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:1823
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:468
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
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:1911
GLuint res
Definition: glext.h:9613
static BOOL compare_pf_data ( const char filename,
const char data,
DWORD  size 
)
static

Definition at line 2427 of file install.c.

Referenced by test_missingcab().

2428 {
2429  DWORD read;
2430  HANDLE handle;
2431  BOOL ret = FALSE;
2432  char *buffer, path[MAX_PATH];
2433 
2434  lstrcpyA(path, PROG_FILES_DIR);
2435  lstrcatA(path, "\\");
2436  lstrcatA(path, filename);
2437 
2439  buffer = HeapAlloc(GetProcessHeap(), 0, size);
2440  if (buffer)
2441  {
2442  ReadFile(handle, buffer, size, &read, NULL);
2443  if (read == size && !memcmp(data, buffer, size)) ret = TRUE;
2444  HeapFree(GetProcessHeap(), 0, buffer);
2445  }
2446  CloseHandle(handle);
2447  return ret;
2448 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#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:67
const char * filename
Definition: ioapi.h:135
DWORD DWORD
Definition: winlogon.h:83
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
#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
GLsizeiptr size
Definition: glext.h:5919
#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:60
Definition: services.c:325
#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 2257 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().

2258 {
2259  CCAB cabParams;
2260  LPCSTR ptr;
2261  HFCI hfci;
2262  ERF erf;
2263  BOOL res;
2264 
2265  set_cab_parameters(&cabParams, name, max_size);
2266 
2269  get_temp_file, &cabParams, NULL);
2270 
2271  ok(hfci != NULL, "Failed to create an FCI context\n");
2272 
2273  ptr = files;
2274  while (*ptr)
2275  {
2276  res = add_file(hfci, ptr, tcompTYPE_MSZIP);
2277  ok(res, "Failed to add file: %s\n", ptr);
2278  ptr += lstrlenA(ptr) + 1;
2279  }
2280 
2282  ok(res, "Failed to flush the cabinet\n");
2283 
2284  res = FCIDestroy(hfci);
2285  ok(res, "Failed to destroy the cabinet\n");
2286 }
BOOL __cdecl FCIFlushCabinet(HFCI hfci, BOOL fGetNextCab, PFNFCIGETNEXTCABINET pfnfcignc, PFNFCISTATUS pfnfcis)
Definition: fci.c:1675
HFCI __cdecl FCICreate(PERF perf, PFNFCIFILEPLACED pfnfiledest, PFNFCIALLOC pfnalloc, PFNFCIFREE pfnfree, PFNFCIOPEN pfnopen, PFNFCIREAD pfnread, PFNFCIWRITE pfnwrite, PFNFCICLOSE pfnclose, PFNFCISEEK pfnseek, PFNFCIDELETE pfndelete, PFNFCIGETTEMPFILE pfnfcigtf, PCCAB pccab, void *pv)
Definition: fci.c:998
BOOL __cdecl FCIDestroy(HFCI hfci)
Definition: fci.c:1709
static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
Definition: install.c:2229
static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
Definition: install.c:2080
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:2056
Definition: fci.h:44
static PVOID ptr
Definition: dispmode.c:27
static INT max_size
Definition: history.c:51
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
static void *CDECL mem_alloc(ULONG cb)
Definition: install.c:2005
#define ok(value,...)
Definition: CComObject.cpp:34
static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
Definition: install.c:2244
static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
Definition: install.c:2015
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:2068
static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
Definition: install.c:2032
static void CDECL mem_free(void *memory)
Definition: install.c:2010
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
static int CDECL fci_delete(char *pszFile, int *err, void *pv)
Definition: install.c:2099
static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
Definition: install.c:2021
Definition: name.c:36
GLuint res
Definition: glext.h:9613
static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
Definition: install.c:2184
static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
Definition: install.c:2088
static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile, BOOL fContinuation, void *pv)
Definition: install.c:2026
static void create_cc_test_files ( void  )
static

Definition at line 2928 of file install.c.

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

2929 {
2930  CCAB cabParams;
2931  HFCI hfci;
2932  ERF erf;
2933  static CHAR cab_context[] = "test%d.cab";
2934  BOOL res;
2935 
2936  create_file("maximus", 500);
2937  create_file("augustus", 50000);
2938  create_file("tiberius", 500);
2939  create_file("caesar", 500);
2940 
2941  set_cab_parameters(&cabParams, "test1.cab", 40000);
2942 
2945  get_temp_file, &cabParams, cab_context);
2946  ok(hfci != NULL, "Failed to create an FCI context\n");
2947 
2948  res = add_file(hfci, "maximus", tcompTYPE_NONE);
2949  ok(res, "Failed to add file maximus\n");
2950 
2951  res = add_file(hfci, "augustus", tcompTYPE_NONE);
2952  ok(res, "Failed to add file augustus\n");
2953 
2954  res = add_file(hfci, "tiberius", tcompTYPE_NONE);
2955  ok(res, "Failed to add file tiberius\n");
2956 
2958  ok(res, "Failed to flush the cabinet\n");
2959 
2960  res = FCIDestroy(hfci);
2961  ok(res, "Failed to destroy the cabinet\n");
2962 
2963  create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
2964 
2965  DeleteFileA("maximus");
2966  DeleteFileA("augustus");
2967  DeleteFileA("tiberius");
2968  DeleteFileA("caesar");
2969 }
#define MEDIA_SIZE
Definition: install.c:2000
BOOL __cdecl FCIFlushCabinet(HFCI hfci, BOOL fGetNextCab, PFNFCIGETNEXTCABINET pfnfcignc, PFNFCISTATUS pfnfcis)
Definition: fci.c:1675
HFCI __cdecl FCICreate(PERF perf, PFNFCIFILEPLACED pfnfiledest, PFNFCIALLOC pfnalloc, PFNFCIFREE pfnfree, PFNFCIOPEN pfnopen, PFNFCIREAD pfnread, PFNFCIWRITE pfnwrite, PFNFCICLOSE pfnclose, PFNFCISEEK pfnseek, PFNFCIDELETE pfndelete, PFNFCIGETTEMPFILE pfnfcigtf, PCCAB pccab, void *pv)
Definition: fci.c:998
char CHAR
Definition: xmlstorage.h:175
BOOL __cdecl FCIDestroy(HFCI hfci)
Definition: fci.c:1709
static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
Definition: install.c:2229
static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
Definition: install.c:2080
Definition: fci.h:144
#define create_file(name, size)
Definition: install.c:2363
#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:2056
Definition: fci.h:44
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
static void *CDECL mem_alloc(ULONG cb)
Definition: install.c:2005
#define ok(value,...)
Definition: CComObject.cpp:34
static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
Definition: install.c:2244
static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
Definition: install.c:2015
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:2068
static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
Definition: install.c:2032
static void CDECL mem_free(void *memory)
Definition: install.c:2010
static int CDECL fci_delete(char *pszFile, int *err, void *pv)
Definition: install.c:2099
static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
Definition: install.c:2021
GLuint res
Definition: glext.h:9613
static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
Definition: install.c:2184
static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
Definition: install.c:2088
static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile, BOOL fContinuation, void *pv)
Definition: install.c:2026
static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
Definition: install.c:2257
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 2529 of file install.c.

Referenced by test_adminimage(), and test_shared_component().

2532 {
2533  MSIHANDLE db;
2534  UINT r;
2535  WCHAR *nameW;
2536  int j, len;
2537 
2538  len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
2539  if (!(nameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return;
2540  MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, len );
2541 
2542  r = MsiOpenDatabaseW(nameW, MSIDBOPEN_CREATE, &db);
2543  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2544 
2545  /* import the tables into the database */
2546  for (j = 0; j < num_tables; j++)
2547  {
2548  const msi_table *table = &tables[j];
2549 
2550  write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
2551 
2552  r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
2553  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2554 
2555  DeleteFileA(table->filename);
2556  }
2557 
2558  write_msi_summary_info(db, version, wordcount, template, packagecode);
2559 
2560  r = MsiDatabaseCommit(db);
2561  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2562 
2563  MsiCloseHandle(db);
2564  HeapFree( GetProcessHeap(), 0, nameW );
2565 }
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:2480
const char * data
Definition: patch.c:127
smooth NULL
Definition: ftsmooth.c:416
static CHAR CURR_DIR[MAX_PATH]
Definition: install.c:66
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define ok(value,...)
Definition: CComObject.cpp:34
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:2490
GLenum GLsizei len
Definition: glext.h:6722
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
UINT WINAPI MsiDatabaseCommit(MSIHANDLE hdb)
Definition: msiquery.c:813
UINT WINAPI MsiOpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIHANDLE *phDB)
Definition: database.c:303
unsigned int UINT
Definition: ndis.h:50
const char * filename
Definition: patch.c:126
#define MultiByteToWideChar
Definition: compat.h:100
int size
Definition: patch.c:128
Definition: name.c:36
#define HeapFree(x, y, z)
Definition: compat.h:394
UINT WINAPI MsiDatabaseImportA(MSIHANDLE handle, LPCSTR szFolder, LPCSTR szFilename)
Definition: database.c:900
static void create_file_data ( LPCSTR  name,
LPCSTR  data,
DWORD  size 
)
static

Definition at line 2343 of file install.c.

Referenced by create_pf_data().

2344 {
2345  HANDLE file;
2346  DWORD written;
2347 
2349  if (file == INVALID_HANDLE_VALUE)
2350  return;
2351 
2352  WriteFile(file, data, strlen(data), &written, NULL);
2353 
2354  if (size)
2355  {
2357  SetEndOfFile(file);
2358  }
2359 
2360  CloseHandle(file);
2361 }
#define CloseHandle
Definition: compat.h:398
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
BOOL WINAPI SetEndOfFile(HANDLE hFile)
Definition: fileinfo.c:1154
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD DWORD
Definition: winlogon.h:83
DWORD WINAPI DECLSPEC_HOTPATCH SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod)
Definition: fileinfo.c:204
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
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
GLsizeiptr size
Definition: glext.h:5919
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:112
DWORD *typedef HANDLE
Definition: winlogon.h:60
Definition: name.c:36
#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 3929 of file install.c.

Referenced by test_missingcab().

3930 {
3931  CHAR path[MAX_PATH];
3932 
3933  lstrcpyA(path, PROG_FILES_DIR);
3934  lstrcatA(path, "\\");
3935  lstrcatA(path, file);
3936 
3937  if (is_file)
3938  create_file_data(path, data, 500);
3939  else
3940  CreateDirectoryA(path, NULL);
3941 }
char CHAR
Definition: xmlstorage.h:175
static CHAR PROG_FILES_DIR[MAX_PATH]
Definition: install.c:67
static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
Definition: install.c:2343
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
smooth NULL
Definition: ftsmooth.c:416
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
#define MAX_PATH
Definition: compat.h:26
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
Definition: services.c:325
Definition: fci.c:126
static void create_test_files ( void  )
static

Definition at line 2365 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().

2366 {
2367  CreateDirectoryA("msitest", NULL);
2368  create_file("msitest\\one.txt", 100);
2369  CreateDirectoryA("msitest\\first", NULL);
2370  create_file("msitest\\first\\two.txt", 100);
2371  CreateDirectoryA("msitest\\second", NULL);
2372  create_file("msitest\\second\\three.txt", 100);
2373 
2374  create_file("four.txt", 100);
2375  create_file("five.txt", 100);
2376  create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
2377 
2378  create_file("msitest\\filename", 100);
2379  create_file("msitest\\service.exe", 100);
2380 
2381  DeleteFileA("four.txt");
2382  DeleteFileA("five.txt");
2383 }
#define MEDIA_SIZE
Definition: install.c:2000
#define create_file(name, size)
Definition: install.c:2363
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
Definition: install.c:2257
static void delete_cab_files ( void  )
static

Definition at line 2971 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().

2972 {
2973  SHFILEOPSTRUCTA shfl;
2974  CHAR path[MAX_PATH+10];
2975 
2976  lstrcpyA(path, CURR_DIR);
2977  lstrcatA(path, "\\*.cab");
2978  path[strlen(path) + 1] = '\0';
2979 
2980  shfl.hwnd = NULL;
2981  shfl.wFunc = FO_DELETE;
2982  shfl.pFrom = path;
2983  shfl.pTo = NULL;
2985 
2986  SHFileOperationA(&shfl);
2987 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLsizei const GLchar ** path
Definition: glext.h:7234
FILEOP_FLAGS fFlags
Definition: shellapi.h:345
#define FOF_SILENT
Definition: shellapi.h:140
char CHAR
Definition: xmlstorage.h:175
#define FOF_NOCONFIRMATION
Definition: shellapi.h:142
smooth NULL
Definition: ftsmooth.c:416
static CHAR CURR_DIR[MAX_PATH]
Definition: install.c:66
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
#define FOF_NORECURSION
Definition: shlfileop.c:38
#define FOF_FILESONLY
Definition: shellapi.h:145
#define MAX_PATH
Definition: compat.h:26
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
Definition: services.c:325
int WINAPI SHFileOperationA(LPSHFILEOPSTRUCTA lpFileOp)
Definition: shlfileop.cpp:999
#define FO_DELETE
Definition: shellapi.h:135
static BOOL delete_cf ( const CHAR rel_path,
BOOL  is_file 
)
static

Definition at line 2413 of file install.c.

Referenced by test_setdirproperty().

2414 {
2415  CHAR path[MAX_PATH];
2416 
2417  lstrcpyA(path, COMMON_FILES_DIR);
2418  lstrcatA(path, "\\");
2419  lstrcatA(path, rel_path);
2420 
2421  if (is_file)
2422  return DeleteFileA(path);
2423  else
2424  return RemoveDirectoryA(path);
2425 }
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:325
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
static CHAR COMMON_FILES_DIR[MAX_PATH]
Definition: install.c:69
static LONG delete_key ( HKEY  key,
LPCSTR  subkey,
REGSAM  access 
)
static

Definition at line 2606 of file install.c.

Referenced by test_feature_override(), and test_MsiInstallProduct().

2607 {
2608  if (pRegDeleteKeyExA)
2609  return pRegDeleteKeyExA( key, subkey, access, 0 );
2610  return RegDeleteKeyA( key, subkey );
2611 }
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 2385 of file install.c.

Referenced by delete_pf_files(), test_admin(), test_adminprops(), test_cabisextracted(), test_caborder(), test_continuouscabs(), test_currentworkingdir(), test_customaction51(), test_feature_override(), test_file_in_use(), test_file_in_use_cab(), test_installstate(), test_missingcab(), test_missingcomponent(), test_mixedmedia(), 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().

2386 {
2387  CHAR path[MAX_PATH];
2388 
2389  lstrcpyA(path, PROG_FILES_DIR);
2390  lstrcatA(path, "\\");
2391  lstrcatA(path, rel_path);
2392 
2393  if (is_file)
2394  return DeleteFileA(path);
2395  else
2396  return RemoveDirectoryA(path);
2397 }
char CHAR
Definition: xmlstorage.h:175
static CHAR PROG_FILES_DIR[MAX_PATH]
Definition: install.c:67
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
#define MAX_PATH
Definition: compat.h:26
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
Definition: services.c:325
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
static void delete_pf_files ( void  )
static

Definition at line 2464 of file install.c.

Referenced by test_adminimage(), test_allusers_prop(), test_installed_prop(), test_MsiInstallProduct(), and test_shortcut().

2465 {
2466  ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2467  ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2468  ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2469  ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2470  ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2471  ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2472  ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2473  ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2474  ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2475  ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2476  ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2477  ok(delete_pf("msitest", FALSE), "Directory not created\n");
2478 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ok(value,...)
Definition: CComObject.cpp:34
static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
Definition: install.c:2385
static BOOL delete_pf_native ( const CHAR rel_path,
BOOL  is_file 
)
static

Definition at line 2399 of file install.c.

Referenced by test_package_validation().

2400 {
2401  CHAR path[MAX_PATH];
2402 
2404  lstrcatA(path, "\\");
2405  lstrcatA(path, rel_path);
2406 
2407  if (is_file)
2408  return DeleteFileA(path);
2409  else
2410  return RemoveDirectoryA(path);
2411 }
char CHAR
Definition: xmlstorage.h:175
static CHAR PROG_FILES_DIR_NATIVE[MAX_PATH]
Definition: install.c:68
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
#define MAX_PATH
Definition: compat.h:26
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
Definition: services.c:325
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
static void delete_pfmsitest_files ( void  )
static

Definition at line 3505 of file install.c.

Referenced by test_icon_table().

3506 {
3507  SHFILEOPSTRUCTA shfl;
3508  CHAR path[MAX_PATH+11];
3509 
3510  lstrcpyA(path, PROG_FILES_DIR);
3511  lstrcatA(path, "\\msitest\\*");
3512  path[strlen(path) + 1] = '\0';
3513 
3514  shfl.hwnd = NULL;
3515  shfl.wFunc = FO_DELETE;
3516  shfl.pFrom = path;
3517  shfl.pTo = NULL;
3519 
3520  SHFileOperationA(&shfl);
3521 
3522  lstrcpyA(path, PROG_FILES_DIR);
3523  lstrcatA(path, "\\msitest");
3524  RemoveDirectoryA(path);
3525 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLsizei const GLchar ** path
Definition: glext.h:7234
FILEOP_FLAGS fFlags
Definition: shellapi.h:345
#define FOF_SILENT
Definition: shellapi.h:140
char CHAR
Definition: xmlstorage.h:175
static CHAR PROG_FILES_DIR[MAX_PATH]
Definition: install.c:67
#define FOF_NOERRORUI
Definition: shellapi.h:148
#define FOF_NOCONFIRMATION
Definition: shellapi.h:142
smooth NULL
Definition: ftsmooth.c:416
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
#define FOF_NORECURSION
Definition: shlfileop.c:38
#define FOF_FILESONLY
Definition: shellapi.h:145
#define MAX_PATH
Definition: compat.h:26
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
Definition: services.c:325
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
int WINAPI SHFileOperationA(LPSHFILEOPSTRUCTA lpFileOp)
Definition: shlfileop.cpp:999
#define FO_DELETE
Definition: shellapi.h:135
static void delete_test_files ( void  )
static

Definition at line 2450 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().

2451 {
2452  DeleteFileA("msitest.msi");
2453  DeleteFileA("msitest.cab");
2454  DeleteFileA("msitest\\second\\three.txt");
2455  DeleteFileA("msitest\\first\\two.txt");
2456  DeleteFileA("msitest\\one.txt");
2457  DeleteFileA("msitest\\service.exe");
2458  DeleteFileA("msitest\\filename");
2459  RemoveDirectoryA("msitest\\second");
2460  RemoveDirectoryA("msitest\\first");
2461  RemoveDirectoryA("msitest");
2462 }
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 2080 of file install.c.

Referenced by create_cab_file(), and create_cc_test_files().

2081 {
2082  HANDLE handle = (HANDLE)hf;
2083  ok(CloseHandle(handle), "Failed to CloseHandle\n");
2084 
2085  return 0;
2086 }
#define CloseHandle
Definition: compat.h:398
#define ok(value,...)
Definition: CComObject.cpp:34
DWORD *typedef HANDLE
Definition: winlogon.h:60
static int CDECL fci_delete ( char pszFile,
int err,
void pv 
)
static

Definition at line 2099 of file install.c.

Referenced by create_cab_file(), and create_cc_test_files().

2100 {
2101  BOOL ret = DeleteFileA(pszFile);
2102  ok(ret, "Failed to DeleteFile %s\n", pszFile);
2103 
2104  return 0;
2105 }
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define ok(value,...)
Definition: CComObject.cpp:34
unsigned int BOOL
Definition: ntddk_ex.h:94
int ret
static INT_PTR CDECL fci_open ( char pszFile,
int  oflag,
int  pmode,
int err,
void pv 
)
static

Definition at line 2032 of file install.c.

Referenced by create_cab_file(), and create_cc_test_files().

2033 {
2034  HANDLE handle;
2035  DWORD dwAccess = 0;
2036  DWORD dwShareMode = 0;
2037  DWORD dwCreateDisposition = OPEN_EXISTING;
2038 
2039  dwAccess = GENERIC_READ | GENERIC_WRITE;
2040  /* FILE_SHARE_DELETE is not supported by Windows Me/98/95 */
2041  dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
2042 
2044  dwCreateDisposition = OPEN_EXISTING;
2045  else
2046  dwCreateDisposition = CREATE_NEW;
2047 
2048  handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
2049  dwCreateDisposition, 0, NULL);
2050 
2051  ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
2052 
2053  return (INT_PTR)handle;
2054 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
int32_t INT_PTR
Definition: typedefs.h:62
DWORD DWORD
Definition: winlogon.h:83
#define FILE_SHARE_READ
Definition: compat.h:125
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:786
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:426
#define ok(value,...)
Definition: CComObject.cpp:34
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define GENERIC_READ
Definition: compat.h:124
DWORD *typedef HANDLE
Definition: winlogon.h:60
#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 2056 of file install.c.

Referenced by create_cab_file(), and create_cc_test_files().

2057 {
2058  HANDLE handle = (HANDLE)hf;
2059  DWORD dwRead;
2060  BOOL res;
2061 
2062  res = ReadFile(handle, memory, cb, &dwRead, NULL);
2063  ok(res, "Failed to ReadFile\n");
2064 
2065  return dwRead;
2066 }
DWORD DWORD
Definition: winlogon.h:83
smooth NULL
Definition: ftsmooth.c:416
void UINT cb
Definition: fci.h:175
#define ok(value,...)
Definition: CComObject.cpp:34
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD *typedef HANDLE
Definition: winlogon.h:60
GLuint res
Definition: glext.h:9613
BOOL WINAPI ReadFile(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead, OUT LPDWORD lpNumberOfBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:123
static LONG CDECL fci_seek ( INT_PTR  hf,
LONG  dist,
int  seektype,
int err,
void pv 
)
static

Definition at line 2088 of file install.c.

Referenced by create_cab_file(), and create_cc_test_files().

2089 {
2090  HANDLE handle = (HANDLE)hf;
2091  DWORD ret;
2092 
2093  ret = SetFilePointer(handle, dist, NULL, seektype);
2094  ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
2095 
2096  return ret;
2097 }
#define INVALID_SET_FILE_POINTER
Definition: winbase.h:115
LONG dist
Definition: fci.h:184
DWORD DWORD
Definition: winlogon.h:83
DWORD WINAPI DECLSPEC_HOTPATCH SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod)
Definition: fileinfo.c:204
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
int ret
DWORD *typedef HANDLE
Definition: winlogon.h:60
LONG int seektype
Definition: fci.h:184
static UINT CDECL fci_write ( INT_PTR  hf,
void memory,
UINT  cb,
int err,
void pv 
)
static

Definition at line 2068 of file install.c.

Referenced by create_cab_file(), and create_cc_test_files().

2069 {
2070  HANDLE handle = (HANDLE)hf;
2071  DWORD dwWritten;
2072  BOOL res;
2073 
2074  res = WriteFile(handle, memory, cb, &dwWritten, NULL);
2075  ok(res, "Failed to WriteFile\n");
2076 
2077  return dwWritten;
2078 }
DWORD DWORD
Definition: winlogon.h:83
smooth NULL
Definition: ftsmooth.c:416
void UINT cb
Definition: fci.h:175
#define ok(value,...)
Definition: CComObject.cpp:34
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:60
GLuint res
Definition: glext.h:9613
static BOOL file_exists ( LPCSTR  file)
static

Definition at line 3489 of file install.c.

Referenced by pf_exists(), and test_icon_table().

3490 {
3492 }
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:786
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
Definition: fci.c:126
static BOOL file_matches ( LPSTR  path)
static

Definition at line 3284 of file install.c.

Referenced by test_readonlyfile().

3285 {
3286  CHAR buf[MAX_PATH];
3287  HANDLE file;
3288  DWORD size;
3289 
3291  NULL, OPEN_EXISTING, 0, NULL);
3292  ZeroMemory(buf, MAX_PATH);
3293  ReadFile(file, buf, 15, &size, NULL);
3294  CloseHandle(file);
3295 
3296  return !lstrcmpA(buf, "msitest\\maximus");
3297 }
DWORD size
Definition: install.c:3631
#define CloseHandle
Definition: compat.h:398
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
char CHAR
Definition: xmlstorage.h:175
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
#define ZeroMemory
Definition: winbase.h:1635
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
DWORD DWORD
Definition: winlogon.h:83
#define FILE_SHARE_READ
Definition: compat.h:125
smooth NULL
Definition: ftsmooth.c:416
#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:60
Definition: services.c:325
#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 5216 of file install.c.

Referenced by test_file_in_use(), and test_file_in_use_cab().

5217 {
5218  DWORD len, data_len = strlen(data);
5219  HANDLE handle;
5220  char buf[128];
5221 
5223  ok(handle != INVALID_HANDLE_VALUE, "failed to open %s (%u)\n", file, GetLastError());
5224 
5225  if (ReadFile(handle, buf, sizeof(buf), &len, NULL) && len >= data_len)
5226  {
5227  CloseHandle(handle);
5228  return !memcmp(buf, data, data_len);
5229  }
5230  CloseHandle(handle);
5231  return FALSE;
5232 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#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
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
DWORD DWORD
Definition: winlogon.h:83
#define FILE_SHARE_READ
Definition: compat.h:125
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:426
#define ok(value,...)
Definition: CComObject.cpp:34
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:60
#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:126
static int CDECL file_placed ( PCCAB  pccab,
char pszFile,
LONG  cbFile,
BOOL  fContinuation,
void pv 
)
static

Definition at line 2026 of file install.c.

Referenced by create_cab_file(), and create_cc_test_files().

2028 {
2029  return 0;
2030 }
static void generate_transform ( void  )
static

Definition at line 3571 of file install.c.

Referenced by test_transformprop().

3572 {
3573  MSIHANDLE hdb1, hdb2;
3574  LPCSTR query;
3575  UINT r;
3576 
3577  /* start with two identical databases */
3579 
3581  ok(r == ERROR_SUCCESS , "Failed to create database\n");
3582 
3583  r = MsiDatabaseCommit(hdb1);
3584  ok(r == ERROR_SUCCESS , "Failed to commit database\n");
3585 
3587  ok(r == ERROR_SUCCESS , "Failed to create database\n");
3588 
3589  query = "INSERT INTO `Property` ( `Property`, `Value` ) VALUES ( 'prop', 'val' )";
3590  r = run_query(hdb1, 0, query);
3591  ok(r == ERROR_SUCCESS, "failed to add property\n");
3592 
3593  /* database needs to be committed */
3594  MsiDatabaseCommit(hdb1);
3595 
3596  r = MsiDatabaseGenerateTransformA(hdb1, hdb2, mstfile, 0, 0);
3597  ok(r == ERROR_SUCCESS, "return code %d, should be ERROR_SUCCESS\n", r);
3598 
3599  r = MsiCreateTransformSummaryInfoA(hdb2, hdb2, mstfile, 0, 0);
3600  todo_wine ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3601 
3602  MsiCloseHandle(hdb1);
3603  MsiCloseHandle(hdb2);
3604 }
#define MSIDBOPEN_READONLY
Definition: msiquery.h:66
static const WCHAR msifileW[]
Definition: install.c:63
#define ERROR_SUCCESS
Definition: deptool.c:10
static const char * msifile
Definition: install.c:59
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static const WCHAR msifile2W[]
Definition: install.c:64
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:797
const char * LPCSTR
Definition: xmlstorage.h:183
#define ok(value,...)
Definition: CComObject.cpp:34
#define MSIDBOPEN_TRANSACT
Definition: msiquery.h:67
#define todo_wine
Definition: test.h:154
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
static UINT run_query(MSIHANDLE hdb, MSIHANDLE hrec, const char *query)
Definition: install.c:3527
UINT WINAPI MsiDatabaseCommit(MSIHANDLE hdb)
Definition: msiquery.c:813
UINT WINAPI MsiOpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIHANDLE *phDB)
Definition: database.c:303
unsigned int UINT
Definition: ndis.h:50
UINT WINAPI MsiCreateTransformSummaryInfoA(MSIHANDLE db, MSIHANDLE db_ref, LPCSTR transform, int error, int validation)
Definition: suminfo.c:1169
static const char * msifile2
Definition: install.c:60
static const char * mstfile
Definition: install.c:61
GLenum query
Definition: glext.h:7781
static void generate_transform_manual ( void  )
static

Definition at line 3641 of file install.c.

Referenced by test_transformprop().

3642 {
3643  IStorage *stg = NULL;
3644  IStream *stm;
3645  WCHAR name[0x20];
3646  HRESULT r;
3647  DWORD i, count;
3649 
3650  const CLSID CLSID_MsiTransform = { 0xc1082,0,0,{0xc0,0,0,0,0,0,0,0x46}};
3651 
3652  MultiByteToWideChar(CP_ACP, 0, mstfile, -1, name, 0x20);
3653 
3654  r = StgCreateDocfile(name, mode, 0, &stg);
3655  ok(r == S_OK, "failed to create storage\n");
3656  if (!stg)
3657  return;
3658 
3659  r = IStorage_SetClass(stg, &CLSID_MsiTransform);
3660  ok(r == S_OK, "failed to set storage type\n");
3661 
3662  for (i=0; i<NUM_TRANSFORM_TABLES; i++)
3663  {
3664  r = IStorage_CreateStream(stg, table_transform_data[i].name,
3665  STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
3666  if (FAILED(r))
3667  {
3668  ok(0, "failed to create stream %08x\n", r);
3669  continue;
3670  }
3671 
3672  r = IStream_Write(stm, table_transform_data[i].data,
3673  table_transform_data[i].size, &count);
3674  if (FAILED(r) || count != table_transform_data[i].size)
3675  ok(0, "failed to write stream\n");
3676  IStream_Release(stm);
3677  }
3678 
3679  IStorage_Release(stg);
3680 
3682 }
#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:83
GLenum GLclampf GLint i
Definition: glfuncs.h:14
static void set_transform_summary_info(void)
Definition: install.c:3543
smooth NULL
Definition: ftsmooth.c:416
#define STGM_WRITE
Definition: objbase.h:917
#define NUM_TRANSFORM_TABLES
Definition: install.c:3639
#define ok(value,...)
Definition: CComObject.cpp:34
GLsizeiptr size
Definition: glext.h:5919
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:8637
#define STGM_READWRITE
Definition: objbase.h:918
#define S_OK
Definition: intsafe.h:59
#define MultiByteToWideChar
Definition: compat.h:100
Definition: name.c:36
static const char * mstfile
Definition: install.c:61
static const struct @1547 table_transform_data[]
static BOOL CDECL get_next_cabinet ( PCCAB  pccab,
ULONG  cbPrevCab,
void pv 
)
static

Definition at line 2015 of file install.c.

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

2016 {
2017  sprintf(pccab->szCab, pv, pccab->iCab);
2018  return TRUE;
2019 }
#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 2203 of file install.c.

Referenced by add_file().

2205 {
2208  HANDLE handle;
2209  DWORD attrs;
2210  BOOL res;
2211 
2212  handle = CreateFileA(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
2214 
2215  ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
2216 
2217  res = GetFileInformationByHandle(handle, &finfo);
2218  ok(res, "Expected GetFileInformationByHandle to succeed\n");
2219 
2220  FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime);
2221  FileTimeToDosDateTime(&filetime, pdate, ptime);
2222 
2223  attrs = GetFileAttributesA(pszName);
2224  ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
2225 
2226  return (INT_PTR)handle;
2227 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
int32_t INT_PTR
Definition: typedefs.h:62
BOOL WINAPI FileTimeToLocalFileTime(IN CONST FILETIME *lpFileTime, OUT LPFILETIME lpLocalFileTime)
Definition: time.c:211
DWORD DWORD
Definition: winlogon.h:83
#define FILE_SHARE_READ
Definition: compat.h:125
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:786
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:426
#define ok(value,...)
Definition: CComObject.cpp:34
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI GetFileInformationByHandle(HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation)
Definition: fileinfo.c:608
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define GENERIC_READ
Definition: compat.h:124
BOOL WINAPI FileTimeToDosDateTime(IN CONST FILETIME *lpFileTime, OUT LPWORD lpFatDate, OUT LPWORD lpFatTime)
Definition: time.c:37
DWORD *typedef HANDLE
Definition: winlogon.h:60
#define FILE_FLAG_SEQUENTIAL_SCAN
Definition: disk.h:43
GLuint res
Definition: glext.h:9613
#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 4558 of file install.c.

Referenced by test_sourcepath().

4559 {
4560  CHAR path[MAX_PATH];
4561  HANDLE hfile;
4562  DWORD size;
4563 
4564  lstrcpyA(path, PROG_FILES_DIR);
4565  lstrcatA(path, "\\");
4566  lstrcatA(path, file);
4567 
4569  if (hfile == INVALID_HANDLE_VALUE)
4570  return INVALID_FILE_SIZE;
4571 
4572  size = GetFileSize(hfile, NULL);
4573  CloseHandle(hfile);
4574  return size;
4575 }
DWORD size
Definition: install.c:3631
#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:67
#define INVALID_FILE_SIZE
Definition: winbase.h:529
DWORD DWORD
Definition: winlogon.h:83
#define FILE_SHARE_READ
Definition: compat.h:125
smooth NULL
Definition: ftsmooth.c:416
#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:481
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
#define GENERIC_READ
Definition: compat.h:124
DWORD *typedef HANDLE
Definition: winlogon.h:60
Definition: services.c:325
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399
Definition: fci.c:126
static BOOL get_system_dirs ( void  )
static

Definition at line 2307 of file install.c.

Referenced by START_TEST().

2308 {
2309  HKEY hkey;
2310  DWORD type, size;
2311 
2312  if (RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion", &hkey))
2313  return FALSE;
2314 
2315  size = MAX_PATH;
2316  if (RegQueryValueExA(hkey, "ProgramFilesDir (x86)", 0, &type, (LPBYTE)PROG_FILES_DIR, &size) &&
2317  RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR, &size)) {
2318  RegCloseKey(hkey);
2319  return FALSE;
2320  }
2321 
2322  size = MAX_PATH;
2323  if (RegQueryValueExA(hkey, "CommonFilesDir (x86)", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size) &&
2324  RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size)) {
2325  RegCloseKey(hkey);
2326  return FALSE;
2327  }
2328 
2329  size = MAX_PATH;
2330  if (RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR_NATIVE, &size)) {
2331  RegCloseKey(hkey);
2332  return FALSE;
2333  }
2334 
2335  RegCloseKey(hkey);
2336 
2338  return FALSE;
2339 
2340  return TRUE;
2341 }
DWORD size
Definition: install.c:3631
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:67
DWORD DWORD
Definition: winlogon.h:83
static CHAR PROG_FILES_DIR_NATIVE[MAX_PATH]
Definition: install.c:68
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:71
#define MAX_PATH
Definition: compat.h:26
UINT WINAPI GetWindowsDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2336
static CHAR COMMON_FILES_DIR[MAX_PATH]
Definition: install.c:69
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
static BOOL CDECL get_temp_file ( char pszTempName,
int  cbTempName,
void pv 
)
static

Definition at line 2184 of file install.c.

Referenced by create_cab_file(), and create_cc_test_files().

2185 {
2186  LPSTR tempname;
2187 
2188  tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
2189  GetTempFileNameA(".", "xx", 0, tempname);
2190 
2191  if (tempname && (strlen(tempname) < (unsigned)cbTempName))
2192  {
2193  lstrcpyA(pszTempName, tempname);
2194  HeapFree(GetProcessHeap(), 0, tempname);
2195  return TRUE;
2196  }
2197 
2198  HeapFree(GetProcessHeap(), 0, tempname);
2199 
2200  return FALSE;
2201 }
#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 2288 of file install.c.

Referenced by START_TEST().

2289 {
2290  HKEY hkey;
2291  DWORD type, size;
2292 
2294  "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey))
2295  return FALSE;
2296 
2297  size = MAX_PATH;
2298  if(RegQueryValueExA(hkey, "AppData", 0, &type, (LPBYTE)APP_DATA_DIR, &size)){
2299  RegCloseKey(hkey);
2300  return FALSE;
2301  }
2302 
2303  RegCloseKey(hkey);
2304  return TRUE;
2305 }
DWORD size
Definition: install.c:3631
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:83
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:70
static void init_functionpointers ( void  )
static

Definition at line 2107 of file install.c.

Referenced by START_TEST().

2108 {
2109  HMODULE hmsi = GetModuleHandleA("msi.dll");
2110  HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
2111  HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
2112 
2113 #define GET_PROC(mod, func) \
2114  p ## func = (void*)GetProcAddress(mod, #func); \
2115  if(!p ## func) \
2116  trace("GetProcAddress(%s) failed\n", #func);
2117 
2121 
2122  GET_PROC(hadvapi32, CheckTokenMembership);
2123  GET_PROC(hadvapi32, ConvertSidToStringSidA);
2124  GET_PROC(hadvapi32, OpenProcessToken);
2125  GET_PROC(hadvapi32, RegDeleteKeyExA)
2126  GET_PROC(hkernel32, IsWow64Process)
2127 
2128  hsrclient = LoadLibraryA("srclient.dll");
2130  GET_PROC(hsrclient, SRSetRestorePointA);
2131 
2132 #undef GET_PROC
2133 }
static HMODULE hsrclient
Definition: install.c:52
INSTALLSTATE WINAPI MsiGetComponentPathExA(LPCSTR product, LPCSTR comp, LPCSTR usersid, MSIINSTALLCONTEXT ctx, LPSTR buf, LPDWORD buflen)
Definition: msi.c:2916
LONG WINAPI RegDeleteKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ REGSAM samDesired, _In_ DWORD Reserved)
Definition: reg.c:1255
static HINSTANCE hkernel32
Definition: process.c:66
BOOL WINAPI CheckTokenMembership(IN HANDLE ExistingTokenHandle, IN PSID SidToCheck, OUT PBOOL IsMember)
Definition: token.c:21
UINT WINAPI MsiSourceListEnumSourcesA(LPCSTR szProductCodeOrPatch, LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwIndex, LPSTR szSource, LPDWORD pcchSource)
Definition: source.c:338
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:2031
BOOL WINAPI ConvertSidToStringSidA(PSID Sid, LPSTR *StringSid)
Definition: security.c:3309
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
BOOL WINAPI SRSetRestorePointA(PRESTOREPOINTINFOA pRestorePtSpec, PSTATEMGRSTATUS pSMgrStatus)
Definition: sfc.c:54
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:292
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:2081
static INSTALLSTATE ( WINAPI pMsiGetComponentPathExA)
static
static BOOL is_process_limited ( void  )
static

Definition at line 2135 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().

2136 {
2138  PSID Group = NULL;
2139  BOOL IsInGroup;
2140  HANDLE token;
2141 
2142  if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE;
2143 
2145  DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
2146  !pCheckTokenMembership(NULL, Group, &IsInGroup))
2147  {
2148  trace("Could not check if the current user is an administrator\n");
2149  FreeSid(Group);
2150  return FALSE;
2151  }
2152  FreeSid(Group);
2153 
2154  if (!IsInGroup)
2155  {
2156  /* Only administrators have enough privileges for these tests */
2157  return TRUE;
2158  }
2159 
2160  if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
2161  {
2162  BOOL ret;
2164  DWORD size;
2165 
2166  ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size);
2167  CloseHandle(token);
2168  return (ret && type == TokenElevationTypeLimited);
2169  }
2170  return FALSE;
2171 }
DWORD size
Definition: install.c:3631
#define trace(...)
Definition: kmt_test.h:217
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:83
#define FALSE
Definition: types.h:117
PVOID WINAPI FreeSid(PSID pSid)
Definition: security.c:573
smooth NULL
Definition: ftsmooth.c:416
#define SECURITY_NT_AUTHORITY
Definition: setypes.h:526
int token
Definition: lex.c:71
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:1195
int ret
DWORD *typedef HANDLE
Definition: winlogon.h:60
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:409
#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:549
static char* load_resource ( const char name)
static

Definition at line 2613 of file install.c.

Referenced by START_TEST().

2614 {
2615  static char path[MAX_PATH];
2616  DWORD written;
2617  HANDLE file;
2618  HRSRC res;
2619  void *ptr;
2620 
2621  GetTempFileNameA(".", name, 0, path);
2622 
2623  file = CreateFileA(path, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
2624  ok(file != INVALID_HANDLE_VALUE, "file creation failed, at %s, error %d\n", path, GetLastError());
2625 
2626  res = FindResourceA(NULL, name, "TESTDLL");
2627  ok( res != 0, "couldn't find resource\n" );
2629  WriteFile( file, ptr, SizeofResource( GetModuleHandleA(NULL), res ), &written, NULL );
2630  ok( written == SizeofResource( GetModuleHandleA(NULL), res ), "couldn't write resource\n" );
2631  CloseHandle( file );
2632 
2633  return path;
2634 }
#define CloseHandle
Definition: compat.h:398
GLsizei const GLchar ** path
Definition: glext.h:7234
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
DWORD DWORD
Definition: winlogon.h:83
#define GENERIC_WRITE
Definition: nt_native.h:90
static PVOID ptr
Definition: dispmode.c:27
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
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
#define MAX_PATH
Definition: compat.h:26
const char file[]
Definition: icontest.c:11
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
#define GENERIC_READ
Definition: compat.h:124
#define CREATE_ALWAYS
Definition: disk.h:72
DWORD *typedef HANDLE
Definition: winlogon.h:60
Definition: services.c:325
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
Definition: name.c:36
GLuint res
Definition: glext.h:9613
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
Definition: filename.c:26
static LONG ( WINAPI pRegDeleteKeyExA)
static
static void* CDECL mem_alloc ( ULONG  cb)
static

Definition at line 2005 of file install.c.

Referenced by create_cab_file(), and create_cc_test_files().

2006 {
2007  return HeapAlloc(GetProcessHeap(), 0, cb);
2008 }
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 2010 of file install.c.

Referenced by create_cab_file(), and create_cc_test_files().

2011 {
2012  HeapFree(GetProcessHeap(), 0, memory);
2013 }
#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 2585 of file install.c.

Referenced by START_TEST().

2586 {
2587  RESTOREPOINTINFOA spec;
2588 
2589  spec.dwEventType = event_type;
2591  spec.llSequenceNumber = status->llSequenceNumber;
2592  lstrcpyA(spec.szDescription, "msitest restore point");
2593 
2594  return pSRSetRestorePointA(&spec, status);
2595 }
#define APPLICATION_INSTALL
CHAR szDescription[MAX_DESC]
INT64 llSequenceNumber
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
static INT CALLBACK ok_callback ( void context,
UINT  message_type,
MSIHANDLE  record 
)
static

Definition at line 4086 of file install.c.

Referenced by START_TEST().

4087 {
4088  if (message_type == INSTALLMESSAGE_USER)
4089  {
4090  char file[200];
4091  char msg[2000];
4092  DWORD len;
4093 
4094  len = sizeof(file);
4095  MsiRecordGetStringA(record, 2, file, &len);
4096  len = sizeof(msg);
4097  MsiRecordGetStringA(record, 5, msg, &len);
4098 
4100  ok_(file, MsiRecordGetInteger(record, 3)) (MsiRecordGetInteger(record, 4), "%s", msg);
4101 
4102  return 1;
4103  }
4104  return 0;
4105 }
int WINAPI MsiRecordGetInteger(MSIHANDLE handle, UINT iField)
Definition: record.c:271
UINT WINAPI MsiRecordGetStringA(MSIHANDLE handle, UINT iField, LPSTR szValue, LPDWORD pcchValue)
Definition: record.c:451
DWORD DWORD
Definition: winlogon.h:83
return
Definition: dirsup.c:529
#define todo_wine_if(is_todo)
Definition: test.h:155
const char file[]
Definition: icontest.c:11
GLdouble s
Definition: gl.h:2039
GLenum GLsizei len
Definition: glext.h:6722
#define msg(x)
Definition: auth_time.c:54
UINT msg
Definition: msvc.h:92
#define ok_(x1, x2)
Definition: CString.cpp:56
Definition: fci.c:126
static BOOL pf_exists ( LPCSTR  file)
static

Definition at line 3494 of file install.c.

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

3495 {
3496  CHAR path[MAX_PATH];
3497 
3498  lstrcpyA(path, PROG_FILES_DIR);
3499  lstrcatA(path, "\\");
3500  lstrcatA(path, file);
3501 
3502  return file_exists(path);
3503 }
char CHAR
Definition: xmlstorage.h:175
static CHAR PROG_FILES_DIR[MAX_PATH]
Definition: install.c:67
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
#define MAX_PATH
Definition: compat.h:26
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
Definition: services.c:325
static BOOL file_exists(LPCSTR file)
Definition: install.c:3489
Definition: fci.c:126
static void process_pending_renames ( HKEY  hkey)
static

Definition at line 5150 of file install.c.

Referenced by test_file_in_use(), and test_file_in_use_cab().

5151 {
5152  char *buf, *src, *dst, *buf2, *buf2ptr;
5153  DWORD size;
5154  LONG ret;
5155  BOOL found = FALSE;
5156 
5157  ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, NULL, &size);
5158  ok(!ret, "RegQueryValueExA failed %d\n", ret);
5159 
5160  buf = HeapAlloc(GetProcessHeap(), 0, size + 1);
5161  buf2ptr = buf2 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + 1);
5162 
5163  ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, (LPBYTE)buf, &size);
5164  buf[size] = 0;
5165  ok(!ret, "RegQueryValueExA failed %d\n", ret);
5166  if (ret) return;
5167 
5168  for (src = buf; *src; src = dst + strlen(dst) + 1)
5169  {
5171  BOOL fileret;
5172 
5173  dst = src + strlen(src) + 1;
5174 
5175  if (!strstr(src, "msitest"))
5176  {
5177  lstrcpyA(buf2ptr, src);
5178  buf2ptr += strlen(src) + 1;
5179  lstrcpyA(buf2ptr, dst);
5180  buf2ptr += strlen(dst) + 1;
5181  continue;
5182  }
5183 
5184  found = TRUE;
5185 
5186  if (*dst == '!')
5187  {
5188  flags |= MOVEFILE_REPLACE_EXISTING;
5189  dst++;
5190  }
5191  if (src[0] == '\\' && src[1] == '?' && src[2] == '?' && src[3] == '\\') src += 4;
5192  if (*dst)
5193  {
5194  if (dst[0] == '\\' && dst[1] == '?' && dst[2] == '?' && dst[3] == '\\') dst += 4;
5195  fileret = MoveFileExA(src, dst, flags);
5196  ok(fileret, "Failed to move file %s -> %s (%u)\n", src, dst, GetLastError());
5197  }
5198  else
5199  {
5200  fileret = DeleteFileA(src);
5201  ok(fileret || broken(!fileret) /* win2k3 */, "Failed to delete file %s (%u)\n", src, GetLastError());
5202  }
5203  }
5204 
5205  ok(found, "Expected a 'msitest' entry\n");
5206 
5207  if (*buf2)
5208  RegSetValueExA(hkey, rename_ops, 0, REG_MULTI_SZ, (LPBYTE)buf2, buf2ptr + 1 - buf2);
5209  else
5210  RegDeleteValueA(hkey, rename_ops);
5211 
5212  HeapFree(GetProcessHeap(), 0, buf);
5213  HeapFree(GetProcessHeap(), 0, buf2);
5214 }
DWORD size
Definition: install.c:3631
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
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
unsigned char * LPBYTE
Definition: typedefs.h:52
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
DWORD DWORD
Definition: winlogon.h:83
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:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define ok(value,...)
Definition: CComObject.cpp:34
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:380
static const char rename_ops[]
Definition: install.c:5148
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
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:379
static LONG CDECL progress ( UINT  typeStatus,
ULONG  cb1,
ULONG  cb2,
void pv 
)
static

Definition at line 2021 of file install.c.

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

2022 {
2023  return 0;
2024 }
static void remove_restore_point ( DWORD  seq_number)
static

Definition at line 2597 of file install.c.

Referenced by START_TEST().

2598 {
2599  DWORD res;
2600 
2601  res = pSRRemoveRestorePoint(seq_number);
2602  if (res != ERROR_SUCCESS)
2603  trace("Failed to remove the restore point : %08x\n", res);
2604 }
#define trace(...)
Definition: kmt_test.h:217
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD DWORD
Definition: winlogon.h:83
GLuint res
Definition: glext.h:9613
static UINT run_query ( MSIHANDLE  hdb,
MSIHANDLE  hrec,
const char query 
)
static

Definition at line 3527 of file install.c.

Referenced by add_custom_dll(), generate_transform(), and test_icon_table().

3528 {
3529  MSIHANDLE hview = 0;
3530  UINT r;
3531 
3532  r = MsiDatabaseOpenViewA(hdb, query, &hview);
3533  if(r != ERROR_SUCCESS)
3534  return r;
3535 
3536  r = MsiViewExecute(hview, hrec);
3537  if(r == ERROR_SUCCESS)
3538  r = MsiViewClose(hview);
3539  MsiCloseHandle(hview);
3540  return r;
3541 }
UINT WINAPI MsiViewExecute(MSIHANDLE hView, MSIHANDLE hRec)
Definition: msiquery.c:459
#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:88
unsigned long MSIHANDLE
Definition: msiserver.idl:25
UINT WINAPI MsiViewClose(MSIHANDLE hView)
Definition: msiquery.c:427
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
unsigned int UINT
Definition: ndis.h:50
static void set_admin_property_stream ( LPCSTR  file)
static

Definition at line 3863 of file install.c.

Referenced by test_adminprops().

3864 {
3865  IStorage *stg;
3866  IStream *stm;
3867  WCHAR fileW[MAX_PATH];
3868  HRESULT hr;
3869  DWORD count;
3871 
3872  /* AdminProperties */
3873  static const WCHAR stmname[] = {0x41ca,0x4330,0x3e71,0x44b5,0x4233,0x45f5,0x422c,0x4836,0};
3874  static const WCHAR data[] = {'M','Y','P','R','O','P','=','2','7','1','8',' ',
3875  'M','y','P','r','o','p','=','4','2',0};
3876 
3877  MultiByteToWideChar(CP_ACP, 0, file, -1, fileW, MAX_PATH);
3878 
3879  hr = StgOpenStorage(fileW, NULL, mode, NULL, 0, &stg);
3880  ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
3881  if (!stg)
3882  return;
3883 
3884  hr = IStorage_CreateStream(stg, stmname, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
3885  ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
3886 
3887  hr = IStream_Write(stm, data, sizeof(data), &count);
3888  ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
3889 
3890  IStream_Release(stm);
3891  IStorage_Release(stg);
3892 }
#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:83
smooth NULL
Definition: ftsmooth.c:416
#define STGM_WRITE
Definition: objbase.h:917
#define ok(value,...)
Definition: CComObject.cpp:34
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:8756
#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
static const WCHAR fileW[]
Definition: url.c:111
Definition: fci.c:126
static void set_admin_summary_info ( const WCHAR name)
static

Definition at line 3796 of file install.c.

Referenced by test_admin(), and test_adminprops().

3797 {
3798  MSIHANDLE db, summary;
3799  UINT r;
3800 
3802  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3803 
3804  r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
3805  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3806 
3808  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3809 
3810  /* write the summary changes back to the stream */
3811  r = MsiSummaryInfoPersist(summary);
3812  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3813 
3814  MsiCloseHandle(summary);
3815 
3816  r = MsiDatabaseCommit(db);
3817  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3818 
3819  MsiCloseHandle(db);
3820 }
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:863
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
UINT WINAPI MsiGetSummaryInformationA(MSIHANDLE hDatabase, LPCSTR szDatabase, UINT uiUpdateCount, MSIHANDLE *pHandle)
Definition: suminfo.c:586
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
UINT WINAPI MsiDatabaseCommit(MSIHANDLE hdb)
Definition: msiquery.c:813
UINT WINAPI MsiOpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIHANDLE *phDB)
Definition: database.c:303
unsigned int UINT
Definition: ndis.h:50
UINT WINAPI MsiSummaryInfoPersist(MSIHANDLE handle)
Definition: suminfo.c:1152
#define PID_WORDCOUNT
Definition: suminfo.c:57
Definition: name.c:36
static void set_cab_parameters ( PCCAB  pCabParams,
const CHAR name,
DWORD  max_size 
)
static

Definition at line 2244 of file install.c.

Referenced by create_cab_file(), and create_cc_test_files().

2245 {
2246  ZeroMemory(pCabParams, sizeof(CCAB));
2247 
2248  pCabParams->cb = max_size;
2249  pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
2250  pCabParams->setID = 0xbeef;
2251  pCabParams->iCab = 1;
2252  lstrcpyA(pCabParams->szCabPath, CURR_DIR);
2253  lstrcatA(pCabParams->szCabPath, "\\");
2254  lstrcpyA(pCabParams->szCab, name);
2255 }
ULONG cbFolderThresh
Definition: fci.h:146
#define ZeroMemory
Definition: winbase.h:1635
Definition: fci.h:144
int iCab
Definition: fci.h:151
char szCab[CB_MAX_CABINET_NAME]
Definition: fci.h:160
static INT max_size
Definition: history.c:51
ULONG cb
Definition: fci.h:145
static CHAR CURR_DIR[MAX_PATH]
Definition: install.c:66
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
USHORT setID
Definition: fci.h:157
Definition: name.c:36
char szCabPath[CB_MAX_CAB_PATH]
Definition: fci.h:161
#define FOLDER_THRESHOLD
Definition: install.c:2001
static void set_transform_summary_info ( void  )
static

Definition at line 3543 of file install.c.

Referenced by generate_transform_manual().

3544 {
3545  UINT r;
3546  MSIHANDLE suminfo = 0;
3547 
3548  /* build summary info */
3549  r = MsiGetSummaryInformationA(0, mstfile, 3, &suminfo);
3550  ok(r == ERROR_SUCCESS , "Failed to open summaryinfo\n");
3551 
3552  r = MsiSummaryInfoSetPropertyA(suminfo, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
3553  ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
3554 
3556  "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
3557  "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
3558  "{4C0EAA15-0264-4E5A-8758-609EF142B92D}");
3559  ok(r == ERROR_SUCCESS , "Failed to set summary info\n");
3560 
3561  r = MsiSummaryInfoSetPropertyA(suminfo, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
3562  ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
3563 
3564  r = MsiSummaryInfoPersist(suminfo);
3565  ok(r == ERROR_SUCCESS , "Failed to make summary info persist\n");
3566 
3567  r = MsiCloseHandle(suminfo);
3568  ok(r == ERROR_SUCCESS , "Failed to close suminfo\n");
3569 }
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:2211
UINT WINAPI MsiSummaryInfoSetPropertyA(MSIHANDLE handle, UINT uiProperty, UINT uiDataType, INT iValue, FILETIME *pftValue, LPCSTR szValue)
Definition: suminfo.c:863
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
#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:586
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
unsigned int UINT
Definition: ndis.h:50
UINT WINAPI MsiSummaryInfoPersist(MSIHANDLE handle)
Definition: suminfo.c:1152
static const char * mstfile
Definition: install.c:61
START_TEST ( install  )

Definition at line 6088 of file install.c.

6089 {
6090  DWORD len;
6091  char temp_path[MAX_PATH], prev_path[MAX_PATH], log_file[MAX_PATH];
6093  BOOL ret = FALSE;
6094 
6096 
6097  if (pIsWow64Process)
6098  pIsWow64Process(GetCurrentProcess(), &is_wow64);
6099 
6100  GetCurrentDirectoryA(MAX_PATH, prev_path);
6101  GetTempPathA(MAX_PATH, temp_path);
6102  SetCurrentDirectoryA(temp_path);
6103 
6104  lstrcpyA(CURR_DIR, temp_path);
6105  len = lstrlenA(CURR_DIR);
6106 
6107  if(len && (CURR_DIR[len - 1] == '\\'))
6108  CURR_DIR[len - 1] = 0;
6109 
6110  ok(get_system_dirs(), "failed to retrieve system dirs\n");
6111  ok(get_user_dirs(), "failed to retrieve user dirs\n");
6112 
6113  /* Create a restore point ourselves so we circumvent the multitude of restore points
6114  * that would have been created by all the installation and removal tests.
6115  *
6116  * This is not needed on version 5.0 where setting MSIFASTINSTALL prevents the
6117  * creation of restore points.
6118  */
6119  if (pSRSetRestorePointA && !pMsiGetComponentPathExA)
6120  {
6121  memset(&status, 0, sizeof(status));
6123  }
6124 
6125  /* Create only one log file and don't append. We have to pass something
6126  * for the log mode for this to work. The logfile needs to have an absolute
6127  * path otherwise we still end up with some extra logfiles as some tests
6128  * change the current directory.
6129  */
6130  lstrcpyA(log_file, temp_path);
6131  lstrcatA(log_file, "\\msitest.log");
6133 
6134  customdll = load_resource("custom.dll");
6136 
6137  if (pSRSetRestorePointA) /* test has side-effects on win2k3 that cause failures in following tests */
6142  test_caborder();
6143  test_mixedmedia();
6152  test_admin();
6153  test_adminprops();
6154  test_missingcab();
6159  test_sourcepath();
6162  test_adminimage();
6163  test_propcase();
6164  test_int_widths();
6165  test_shortcut();
6166  test_preselected();
6168  test_file_in_use();
6172  test_icon_table();
6181 
6183 
6184  DeleteFileA(log_file);
6185 
6186  if (pSRSetRestorePointA && !pMsiGetComponentPathExA && ret)
6187  {
6189  if (ret)
6191  }
6193 
6194  SetCurrentDirectoryA(prev_path);
6195 }
static void test_currentworkingdir(void)
Definition: install.c:3730
static void test_mixed_package(void)
Definition: install.c:5742
static void test_cabisextracted(void)
Definition: install.c:3441
static HMODULE hsrclient
Definition: install.c:52
static void test_propcase(void)
Definition: install.c:4821
static void test_missingcomponent(void)
Definition: install.c:4658
static void test_adminprops(void)
Definition: install.c:3894
static void init_functionpointers(void)
Definition: install.c:2107
static void test_upgrade_code(void)
Definition: install.c:5710
static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
Definition: install.c:2585
static void test_caborder(void)
Definition: install.c:3096
static void test_installstate(void)
Definition: install.c:4172
static BOOL get_system_dirs(void)
Definition: install.c:2307
DWORD DWORD
Definition: winlogon.h:83
static void test_continuouscabs(void)
Definition: install.c:2989
static void test_readonlyfile_cab(void)
Definition: install.c:3347
static const char * customdll
Definition: install.c:73
static void test_sourcefolder(void)
Definition: install.c:4015
static char * load_resource(const char *name)
Definition: install.c:2613
static void test_missingcab(void)
Definition: install.c:3945
static void test_customaction51(void)
Definition: install.c:4139
#define FALSE
Definition: types.h:117
static void test_adminimage(void)
Definition: install.c:4765
static void test_int_widths(void)
Definition: install.c:4864
#define END_NESTED_SYSTEM_CHANGE
static void test_installed_prop(void)
Definition: install.c:5036
static void test_transformprop(void)
Definition: install.c:3684
static void test_allusers_prop(void)
Definition: install.c:5076
smooth NULL
Definition: ftsmooth.c:416
static CHAR CURR_DIR[MAX_PATH]
Definition: install.c:66
static BOOL get_user_dirs(void)
Definition: install.c:2288
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define ok(value,...)
Definition: CComObject.cpp:34
static void test_setdirproperty(void)
Definition: install.c:3408
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:6016
INT64 llSequenceNumber
static STATEMGRSTATUS *static BOOL is_wow64
Definition: install.c:54
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1195
static void test_icon_table(void)
Definition: install.c:5437
#define MAX_PATH
Definition: compat.h:26
UINT WINAPI MsiSetExternalUIRecord(INSTALLUI_HANDLER_RECORD handler, DWORD filter, LPVOID context, PINSTALLUI_HANDLER_RECORD prev)
Definition: msi.c:4224
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
static INT CALLBACK ok_callback(void *context, UINT message_type, MSIHANDLE record)
Definition: install.c:4086
static void test_readonlyfile(void)
Definition: install.c:3299
static void test_file_in_use_cab(void)
Definition: install.c:5293
static void test_feature_override(void)
Definition: install.c:5356
int ret
static void test_sourcedirprop(void)
Definition: install.c:4713
static void test_preselected(void)
Definition: install.c:4979
static void remove_restore_point(DWORD seq_number)
Definition: install.c:2597
BOOL WINAPI SetCurrentDirectoryA(IN LPCSTR lpPathName)
Definition: path.c:2205
static void test_mixedmedia(void)
Definition: install.c:3182
GLenum GLsizei len
Definition: glext.h:6722
static void test_volume_props(void)
Definition: install.c:5895
static void test_customaction1(void)
Definition: install.c:4107
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2053
static void test_samesequence(void)
Definition: install.c:3225
static void test_sourcepath(void)
Definition: install.c:4577
static void test_file_in_use(void)
Definition: install.c:5234
static void test_deferred_action(void)
Definition: install.c:6057
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2145
static void test_uiLevelFlags(void)
Definition: install.c:3254
static void test_packagecoltypes(void)
Definition: install.c:2873
static void test_MsiSetComponentState(void)
Definition: install.c:2824
static void test_remove_upgrade_code(void)
Definition: install.c:5965
static void test_MsiInstallProduct(void)
Definition: install.c:2636
#define memset(x, y, z)
Definition: compat.h:39
static void test_shared_component(void)
Definition: install.c:5921
static SERVICE_STATUS status
Definition: service.c:31
static void test_admin(void)
Definition: install.c:3822
UNICODE_STRING log_file
Definition: btrfs.c:83
static void test_shortcut(void)
Definition: install.c:4931
UINT WINAPI MsiEnableLogA(DWORD dwLogMode, LPCSTR szLogFile, DWORD attributes)
Definition: msi.c:1908
static void test_package_validation(void)
Definition: install.c:5519
static void test_admin ( void  )
static

Definition at line 3822 of file install.c.

Referenced by START_TEST().

3823 {
3824  UINT r;
3825 
3826  CreateDirectoryA("msitest", NULL);
3827  create_file("msitest\\augustus", 500);
3828 
3829  create_database(msifile, adm_tables, sizeof(adm_tables) / sizeof(msi_table));
3831 
3833 
3836  {
3837  skip("Not enough rights to perform tests\n");
3838  goto error;
3839  }
3840  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3841  ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3842  ok(!delete_pf("msitest", FALSE), "Directory created\n");
3843  ok(!DeleteFileA("c:\\msitest\\augustus"), "File installed\n");
3844  ok(!RemoveDirectoryA("c:\\msitest"), "File installed\n");
3845 
3846  r = MsiInstallProductA(msifile, "ACTION=ADMIN");
3847  todo_wine
3848  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3849  ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3850  ok(!delete_pf("msitest", FALSE), "Directory created\n");
3851  todo_wine
3852  {
3853  ok(DeleteFileA("c:\\msitest\\augustus"), "File not installed\n");
3854  ok(RemoveDirectoryA("c:\\msitest"), "File not installed\n");
3855  }
3856 
3857 error:
3859  DeleteFileA("msitest\\augustus");
3860  RemoveDirectoryA("msitest");
3861 }
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define TRUE
Definition: types.h:120
static const WCHAR msifileW[]
Definition: install.c:63
#define ERROR_SUCCESS
Definition: deptool.c:10
static const char * msifile
Definition: install.c:59
#define error(str)
Definition: mkdosfs.c:1605
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:205
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2313
#define create_database(name, tables, num_tables)
Definition: install.c:2521
#define create_file(name, size)
Definition: install.c:2363
#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:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define ok(value,...)
Definition: CComObject.cpp:34
static const msi_table adm_tables[]
Definition: install.c:1649
#define todo_wine
Definition: test.h:154
static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
Definition: install.c:2385
#define skip(...)
Definition: CString.cpp:57
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
unsigned int UINT
Definition: ndis.h:50
static void set_admin_summary_info(const WCHAR *name)
Definition: install.c:3796
static void test_adminimage ( void  )
static

Definition at line 4765 of file install.c.

Referenced by START_TEST().

4766 {
4767  UINT r;
4768 
4769  if (is_process_limited())
4770  {
4771  skip("process is limited\n");
4772  return;
4773  }
4774 
4775  CreateDirectoryA("msitest", NULL);
4776  CreateDirectoryA("msitest\\first", NULL);
4777  CreateDirectoryA("msitest\\second", NULL);
4778  CreateDirectoryA("msitest\\cabout", NULL);
4779  CreateDirectoryA("msitest\\cabout\\new", NULL);
4780  create_file("msitest\\one.txt", 100);
4781  create_file("msitest\\first\\two.txt", 100);
4782  create_file("msitest\\second\\three.txt", 100);
4783  create_file("msitest\\cabout\\four.txt", 100);
4784  create_file("msitest\\cabout\\new\\five.txt", 100);
4785  create_file("msitest\\filename", 100);
4786  create_file("msitest\\service.exe", 100);
4787 
4789  sizeof(ai_tables) / sizeof(msi_table),
4790  100, msidbSumInfoSourceTypeAdminImage, ";1033",
4791  "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
4792 
4794 
4797  {
4798  skip("Not enough rights to perform tests\n");
4799  goto error;
4800  }
4801  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4802 
4803  delete_pf_files();
4804 
4805 error:
4806  DeleteFileA("msifile");
4807  DeleteFileA("msitest\\cabout\\new\\five.txt");
4808  DeleteFileA("msitest\\cabout\\four.txt");
4809  DeleteFileA("msitest\\second\\three.txt");
4810  DeleteFileA("msitest\\first\\two.txt");
4811  DeleteFileA("msitest\\one.txt");
4812  DeleteFileA("msitest\\service.exe");
4813  DeleteFileA("msitest\\filename");
4814  RemoveDirectoryA("msitest\\cabout\\new");
4815  RemoveDirectoryA("msitest\\cabout");
4816  RemoveDirectoryA("msitest\\second");
4817  RemoveDirectoryA("msitest\\first");
4818  RemoveDirectoryA("msitest");
4819 }
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define ERROR_SUCCESS
Definition: deptool.c:10
static const char * msifile
Definition: install.c:59
#define error(str)
Definition: mkdosfs.c:1605
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:205
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2313
#define create_file(name, size)
Definition: install.c:2363
static const msi_table ai_tables[]
Definition: install.c:1756
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define ok(value,...)
Definition: CComObject.cpp:34
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:2529
static void delete_pf_files(void)
Definition: install.c:2464
#define skip(...)
Definition: CString.cpp:57
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
unsigned int UINT
Definition: ndis.h:50
static BOOL is_process_limited(void)
Definition: install.c:2135
static void test_adminprops ( void  )
static

Definition at line 3894 of file install.c.

Referenced by START_TEST().

3895 {
3896  UINT r;
3897 
3898  if (is_process_limited())
3899  {
3900  skip("process is limited\n");
3901  return;
3902  }
3903 
3904  CreateDirectoryA("msitest", NULL);
3905  create_file("msitest\\augustus", 500);
3906 
3907  create_database(msifile, amp_tables, sizeof(amp_tables) / sizeof(msi_table));
3910 
3912 
3915  {
3916  skip("Not enough rights to perform tests\n");
3917  goto error;
3918  }
3919  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3920  ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
3921  ok(delete_pf("msitest", FALSE), "Directory created\n");
3922 
3923 error:
3925  DeleteFileA("msitest\\augustus");
3926  RemoveDirectoryA("msitest");
3927 }
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define TRUE
Definition: types.h:120
static const WCHAR msifileW[]
Definition: install.c:63
#define ERROR_SUCCESS
Definition: deptool.c:10
static const char * msifile
Definition: install.c:59
#define error(str)
Definition: mkdosfs.c:1605
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:205
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2313
#define create_database(name, tables, num_tables)
Definition: install.c:2521
#define create_file(name, size)
Definition: install.c:2363
#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:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define ok(value,...)
Definition: CComObject.cpp:34
static const msi_table amp_tables[]
Definition: install.c:1663
static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
Definition: install.c:2385
#define skip(...)
Definition: CString.cpp:57
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
unsigned int UINT
Definition: ndis.h:50
static BOOL is_process_limited(void)
Definition: install.c:2135
static void set_admin_summary_info(const WCHAR *name)
Definition: install.c:3796
static void set_admin_property_stream(LPCSTR file)
Definition: install.c:3863
static void test_allusers_prop ( void  )
static

Definition at line 5076 of file install.c.

Referenced by START_TEST().

5077 {
5078  UINT r;
5079 
5080  if (is_process_limited())
5081  {
5082  skip("process is limited\n");
5083  return;
5084  }
5085 
5087  create_database(msifile, aup_tables, sizeof(aup_tables) / sizeof(msi_table));
5088 
5090 
5091  /* ALLUSERS property unset */
5092  r = MsiInstallProductA(msifile, "FULL=1");
5094  {
5095  skip("Not enough rights to perform tests\n");
5096  goto error;
5097  }
5098  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5099 
5100  delete_pf_files();
5101 
5102  r = MsiInstallProductA(msifile, "REMOVE=ALL");
5103  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5104 
5106 
5109 
5110  /* ALLUSERS property set to 1 */
5111  r = MsiInstallProductA(msifile, "FULL=1");
5112  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5113 
5114  delete_pf_files();
5115 
5116  r = MsiInstallProductA(msifile, "REMOVE=ALL");
5117  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5118 
5120 
5123 
5124  /* ALLUSERS property set to 2 */
5125  r = MsiInstallProductA(msifile, "FULL=1");
5126  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5127 
5128  delete_pf_files();
5129 
5130  r = MsiInstallProductA(msifile, "REMOVE=ALL");
5131  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5132 
5134 
5137 
5138  /* ALLUSERS property set to 2, conditioned on ALLUSERS = 1 */
5139  r = MsiInstallProductA(msifile, "FULL=1");
5140  ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5141 
5142 error:
5145 }
static void delete_test_files(void)
Definition: install.c:2450
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define ERROR_SUCCESS
Definition: deptool.c:10
static const char * msifile
Definition: install.c:59
#define error(str)
Definition: mkdosfs.c:1605
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:205
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2313
#define create_database(name, tables, num_tables)
Definition: install.c:2521
static const msi_table aup3_tables[]
Definition: install.c:1819
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24