xref: /reactos/modules/rostests/winetests/msi/utils.h (revision d6eebaa4)
1 /*
2  * Copyright 2018 Zebediah Figura
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18 
19 extern char PROG_FILES_DIR[MAX_PATH];
20 extern char PROG_FILES_DIR_NATIVE[MAX_PATH];
21 extern char COMMON_FILES_DIR[MAX_PATH];
22 extern char APP_DATA_DIR[MAX_PATH];
23 extern char WINDOWS_DIR[MAX_PATH];
24 extern char CURR_DIR[MAX_PATH];
25 
26 BOOL get_system_dirs(void);
27 BOOL get_user_dirs(void);
28 
29 typedef struct _msi_table
30 {
31     const char *filename;
32     const char *data;
33     int size;
34 } msi_table;
35 
36 #define ADD_TABLE(x) {#x".idt", x##_dat, sizeof(x##_dat)}
37 
38 /* in install.c */
39 void create_database_wordcount(const char *name, const msi_table *tables, int num_tables,
40     int version, int wordcount, const char *template, const char *packagecode);
41 
42 #define create_database(name, tables, num_tables) \
43     create_database_wordcount(name, tables, num_tables, 100, 0, ";1033", \
44                               "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
45 
46 #define create_database_template(name, tables, num_tables, version, template) \
47     create_database_wordcount(name, tables, num_tables, version, 0, template, \
48                               "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
49 
50 void create_cab_file(const char *name, DWORD max_size, const char *files);
51 void create_file_data(const char *name, const char *data, DWORD size);
52 #define create_file(name, size) create_file_data(name, name, size)
53 void create_pf_data(const char *file, const char *data, BOOL is_file);
54 #define create_pf(file, is_file) create_pf_data(file, file, is_file)
55 void delete_cab_files(void);
56 BOOL delete_pf(const char *rel_path, BOOL is_file);
57 BOOL file_exists(const char *file);
58 BOOL pf_exists(const char *file);
59 BOOL is_process_elevated(void);
60 UINT run_query(MSIHANDLE hdb, MSIHANDLE hrec, const char *query);
61 void restart_as_admin_elevated(void);
62