ReactOS  0.4.14-dev-114-gc8cbd56
msi.c File Reference
#include <stdio.h>
#include <windows.h>
#include <msi.h>
#include <msiquery.h>
#include <msidefs.h>
#include <sddl.h>
#include <fci.h>
#include <shellapi.h>
#include <objidl.h>
#include "wine/test.h"
Include dependency graph for msi.c:

Go to the source code of this file.

Classes

struct  _msi_table
 

Macros

#define _WIN32_MSI   300
 
#define COBJMACROS
 
#define GET_PROC(dll, func)
 
#define MEDIA_SIZE   0x7FFFFFFF
 
#define FOLDER_THRESHOLD   900000
 
#define ADD_TABLE(x)   {#x".idt", x##_dat, sizeof(x##_dat)}
 
#define create_database(name, tables, num_tables)   create_database_wordcount(name, tables, num_tables, 100, 0, ";1033");
 
#define create_database_template(name, tables, num_tables, version, template)   create_database_wordcount(name, tables, num_tables, version, 0, template);
 
#define HASHSIZE   sizeof(MSIFILEHASHINFO)
 
#define INIT_USERINFO()
 

Typedefs

typedef struct _msi_table msi_table
 

Functions

static BOOL (WINAPI *pCheckTokenMembership)(HANDLE
 
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY
 
static INSTALLSTATE (WINAPI *pMsiGetComponentPathA)(LPCSTR
 
static UINT (WINAPI *pMsiGetFileHashA)(LPCSTR
 
static void init_functionpointers (void)
 
static BOOL get_system_dirs (void)
 
static BOOL file_exists (const char *file)
 
static BOOL pf_exists (const char *file)
 
static BOOL delete_pf (const char *rel_path, BOOL is_file)
 
static BOOL is_process_limited (void)
 
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 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 add_cabinet_storage (LPCSTR db, LPCSTR cabinet)
 
static void delete_cab_files (void)
 
static void write_file (const CHAR *filename, const char *data, int data_size)
 
static void write_msi_summary_info (MSIHANDLE db, INT version, INT wordcount, const char *template)
 
static void create_database_wordcount (const CHAR *name, const msi_table *tables, int num_tables, INT version, INT wordcount, const char *template)
 
static UINT run_query (MSIHANDLE hdb, const char *query)
 
static UINT set_summary_info (MSIHANDLE hdb, LPSTR prodcode)
 
static MSIHANDLE create_package_db (LPSTR prodcode)
 
static void test_usefeature (void)
 
static LONG delete_key (HKEY key, LPCSTR subkey, REGSAM access)
 
static void test_null (void)
 
static void test_getcomponentpath (void)
 
static void create_file (LPCSTR name, LPCSTR data, DWORD size)
 
static void create_test_files (void)
 
static void delete_test_files (void)
 
static void test_MsiGetFileHash (void)
 
static BOOL squash_guid (LPCWSTR in, LPWSTR out)
 
static void create_test_guid (LPSTR prodcode, LPSTR squashed)
 
static charget_user_sid (void)
 
static void test_MsiQueryProductState (void)
 
static void encode_base85_guid (GUID *guid, LPWSTR str)
 
static void compose_base85_guid (LPSTR component, LPSTR comp_base85, LPSTR squashed)
 
static void test_MsiQueryFeatureState (void)
 
static void test_MsiQueryComponentState (void)
 
static void test_MsiGetComponentPath (void)
 
static void test_MsiGetComponentPathEx (void)
 
static void test_MsiProvideComponent (void)
 
static void test_MsiProvideQualifiedComponentEx (void)
 
static void test_MsiGetProductCode (void)
 
static void test_MsiEnumClients (void)
 
static void get_version_info (LPSTR path, LPSTR *vercheck, LPDWORD verchecksz, LPSTR *langcheck, LPDWORD langchecksz)
 
static void test_MsiGetFileVersion (void)
 
static void test_MsiGetProductInfo (void)
 
static void test_MsiGetProductInfoEx (void)
 
static void test_MsiGetUserInfo (void)
 
static void test_MsiOpenProduct (void)
 
static void test_MsiEnumPatchesEx_usermanaged (LPCSTR usersid, LPCSTR expectedsid)
 
static void test_MsiEnumPatchesEx_userunmanaged (LPCSTR usersid, LPCSTR expectedsid)
 
static void test_MsiEnumPatchesEx_machine (void)
 
static void test_MsiEnumPatchesEx (void)
 
static void test_MsiEnumPatches (void)
 
static void test_MsiGetPatchInfoEx (void)
 
static void test_MsiGetPatchInfo (void)
 
static void test_MsiEnumProducts (void)
 
static void test_MsiGetFileSignatureInformation (void)
 
static void test_MsiEnumProductsEx (void)
 
static void test_MsiEnumComponents (void)
 
static void test_MsiEnumComponentsEx (void)
 
static void test_MsiConfigureProductEx (void)
 
static void test_MsiSetFeatureAttributes (void)
 
static void test_MsiGetFeatureInfo (void)
 
static INT CALLBACK handler_a (LPVOID context, UINT type, LPCSTR msg)
 
static INT CALLBACK handler_w (LPVOID context, UINT type, LPCWSTR msg)
 
static INT CALLBACK handler_record (LPVOID context, UINT type, MSIHANDLE record)
 
static void test_MsiSetInternalUI (void)
 
static void test_MsiSetExternalUI (void)
 
static void test_lastusedsource (void)
 
static void test_setpropertyfolder (void)
 
static void test_sourcedir_props (void)
 
static void test_concurrentinstall (void)
 
static void test_command_line_parsing (void)
 
 START_TEST (msi)
 

Variables

static BOOL is_wow64
 
static const char msifile [] = "winetest.msi"
 
static const WCHAR msifileW [] = {'w','i','n','e','t','e','s','t','.','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 WINDOWS_DIR [MAX_PATH]
 
static PSID
 
static PBOOL
 
static LPSTR *static DWORD
 
static LPSTR *static PHANDLE
 
static LPCSTR
 
static REGSAM
 
static LPSTR
 
static DWORD *static MSIINSTALLCONTEXT
 
static DWORD *static LPDWORD
 
static LPCWSTR
 
static LPWSTR
 
static PMSIFILEHASHINFO
 
static DWORD *static CHAR [39]
 
static LPVOID
 
static PINSTALLUI_HANDLER_RECORD
 
static const char directory_dat []
 
static const char component_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 ci2_property_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 lus_component_dat []
 
static const char lus_feature_dat []
 
static const char lus_file_dat []
 
static const char lus_feature_comp_dat []
 
static const char lus_install_exec_seq_dat []
 
static const char lus0_media_dat []
 
static const char lus1_media_dat []
 
static const char lus2_media_dat []
 
static const char spf_custom_action_dat []
 
static const char spf_install_exec_seq_dat []
 
static const char spf_install_ui_seq_dat []
 
static const char sd_file_dat []
 
static const char sd_feature_dat []
 
static const char sd_feature_comp_dat []
 
static const char sd_component_dat []
 
static const char sd_install_ui_seq_dat []
 
static const char sd_install_exec_seq_dat []
 
static const char sd_custom_action_dat []
 
static const char ci_install_exec_seq_dat []
 
static const char ci_custom_action_dat []
 
static const char ci_component_dat []
 
static const char ci2_component_dat []
 
static const char ci2_feature_comp_dat []
 
static const char ci2_file_dat []
 
static const char cl_custom_action_dat []
 
static const char cl_install_exec_seq_dat []
 
static const msi_table tables []
 
static const msi_table mcp_tables []
 
static const msi_table lus0_tables []
 
static const msi_table lus1_tables []
 
static const msi_table lus2_tables []
 
static const msi_table spf_tables []
 
static const msi_table sd_tables []
 
static const msi_table ci_tables []
 
static const msi_table ci2_tables []
 
static const msi_table cl_tables []
 
struct {
   LPCSTR   data
 
   DWORD   size
 
   MSIFILEHASHINFO   hash
 
hash_data []
 
static const char table_enc85 []
 

Macro Definition Documentation

◆ _WIN32_MSI

#define _WIN32_MSI   300

Definition at line 21 of file msi.c.

◆ ADD_TABLE

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

Definition at line 918 of file msi.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 22 of file msi.c.

◆ create_database

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

Definition at line 1087 of file msi.c.

◆ create_database_template

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

Definition at line 1090 of file msi.c.

◆ FOLDER_THRESHOLD

#define FOLDER_THRESHOLD   900000

Definition at line 226 of file msi.c.

◆ GET_PROC

#define GET_PROC (   dll,
  func 
)
Value:
p ## func = (void *)GetProcAddress(dll, #func); \
if(!p ## func) \
trace("GetProcAddress(%s) failed\n", #func);
GLenum func
Definition: glext.h:6028
static HMODULE dll
Definition: str.c:188
#define GetProcAddress(x, y)
Definition: compat.h:410
GLfloat GLfloat p
Definition: glext.h:8902

◆ HASHSIZE

#define HASHSIZE   sizeof(MSIFILEHASHINFO)

Definition at line 1483 of file msi.c.

◆ INIT_USERINFO

#define INIT_USERINFO ( )
Value:
lstrcpyA(user, "apple"); \
lstrcpyA(org, "orange"); \
lstrcpyA(serial, "banana"); \
usersz = orgsz = serialsz = MAX_PATH;
static char org[]
Definition: encode.c:7456
#define MAX_PATH
Definition: compat.h:26
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
uint32_t serial
Definition: fsck.fat.h:64
void user(int argc, const char *argv[])
Definition: cmds.c:1350

Definition at line 8795 of file msi.c.

◆ MEDIA_SIZE

#define MEDIA_SIZE   0x7FFFFFFF

Definition at line 225 of file msi.c.

Typedef Documentation

◆ msi_table

Function Documentation

◆ add_cabinet_storage()

static BOOL add_cabinet_storage ( LPCSTR  db,
LPCSTR  cabinet 
)
static

Definition at line 435 of file msi.c.

436 {
437  WCHAR dbW[MAX_PATH], cabinetW[MAX_PATH];
438  IStorage *stg;
439  IStream *stm;
440  HRESULT hr;
441  HANDLE handle;
442 
443  MultiByteToWideChar(CP_ACP, 0, db, -1, dbW, MAX_PATH);
445  if (FAILED(hr))
446  return FALSE;
447 
448  MultiByteToWideChar(CP_ACP, 0, cabinet, -1, cabinetW, MAX_PATH);
449  hr = IStorage_CreateStream(stg, cabinetW, STGM_WRITE|STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
450  if (FAILED(hr))
451  {
452  IStorage_Release(stg);
453  return FALSE;
454  }
455 
456  handle = CreateFileW(cabinetW, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
458  {
459  DWORD count;
460  char buffer[1024];
461  if (ReadFile(handle, buffer, sizeof(buffer), &count, NULL))
462  IStream_Write(stm, buffer, count, &count);
464  }
465 
466  IStream_Release(stm);
467  IStorage_Release(stg);
468 
469  return TRUE;
470 }
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
HRESULT hr
Definition: shlfolder.c:183
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:922
#define CP_ACP
Definition: compat.h:99
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
GLuint buffer
Definition: glext.h:5915
smooth NULL
Definition: ftsmooth.c:416
#define STGM_WRITE
Definition: objbase.h:917
#define OPEN_EXISTING
Definition: compat.h:426
__wchar_t WCHAR
Definition: xmlstorage.h:180
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
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GENERIC_READ
Definition: compat.h:124
#define STGM_READWRITE
Definition: objbase.h:918
#define MultiByteToWideChar
Definition: compat.h:100
#define CreateFileW
Definition: compat.h:400
BOOL WINAPI ReadFile(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead, OUT LPDWORD lpNumberOfBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:123

Referenced by test_lastusedsource().

◆ add_file()

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

Definition at line 376 of file msi.c.

377 {
378  char path[MAX_PATH];
379  char filename[MAX_PATH];
380 
382  lstrcatA(path, "\\");
383  lstrcatA(path, file);
384 
386 
389 }
const char * filename
Definition: ioapi.h:135
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
Definition: compress.c:68
#define MAX_PATH
Definition: compat.h:26
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
static char CURR_DIR[MAX_PATH]
Definition: msi.c:39
static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
Definition: msi.c:246
Definition: services.c:325
BOOL __cdecl FCIAddFile(HFCI hfci, char *pszSourceFile, char *pszFileName, BOOL fExecute, PFNFCIGETNEXTCABINET pfnfcignc, PFNFCISTATUS pfnfcis, PFNFCIGETOPENINFO pfnfcigoi, TCOMP typeCompress)
Definition: fci.c:1397
static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime, USHORT *pattribs, int *err, void *pv)
Definition: msi.c:351
static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
Definition: msi.c:240
Definition: fci.c:126

Referenced by create_cab_file().

◆ BOOL()

static BOOL ( WINAPI pCheckTokenMembership)
static

◆ compose_base85_guid()

static void compose_base85_guid ( LPSTR  component,
LPSTR  comp_base85,
LPSTR  squashed 
)
static

Definition at line 1977 of file msi.c.

1978 {
1979  WCHAR guidW[MAX_PATH];
1980  WCHAR base85W[MAX_PATH];
1981  WCHAR squashedW[MAX_PATH];
1982  GUID guid;
1983  HRESULT hr;
1984  int size;
1985 
1986  hr = CoCreateGuid(&guid);
1987  ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
1988 
1989  size = StringFromGUID2(&guid, guidW, MAX_PATH);
1990  ok(size == 39, "Expected 39, got %d\n", hr);
1991 
1992  WideCharToMultiByte(CP_ACP, 0, guidW, size, component, MAX_PATH, NULL, NULL);
1993  encode_base85_guid(&guid, base85W);
1994  WideCharToMultiByte(CP_ACP, 0, base85W, -1, comp_base85, MAX_PATH, NULL, NULL);
1995  squash_guid(guidW, squashedW);
1996  WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
1997 }
static void encode_base85_guid(GUID *guid, LPWSTR str)
Definition: msi.c:1956
#define WideCharToMultiByte
Definition: compat.h:101
HRESULT hr
Definition: shlfolder.c:183
#define CP_ACP
Definition: compat.h:99
const GUID * guid
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2343
HRESULT WINAPI CoCreateGuid(GUID *pguid)
Definition: compobj.c:2115
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
DWORD size
Definition: msi.c:1488
static BOOL squash_guid(LPCWSTR in, LPWSTR out)
Definition: msi.c:1578

Referenced by test_MsiEnumClients(), test_MsiGetComponentPath(), test_MsiGetComponentPathEx(), test_MsiGetProductCode(), test_MsiProvideQualifiedComponentEx(), test_MsiQueryComponentState(), and test_MsiQueryFeatureState().

◆ create_cab_file()

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

Definition at line 404 of file msi.c.

405 {
406  CCAB cabParams;
407  LPCSTR ptr;
408  HFCI hfci;
409  ERF erf;
410  BOOL res;
411 
412  set_cab_parameters(&cabParams, name, max_size);
413 
416  get_temp_file, &cabParams, NULL);
417 
418  ok(hfci != NULL, "Failed to create an FCI context\n");
419 
420  ptr = files;
421  while (*ptr)
422  {
423  res = add_file(hfci, ptr, tcompTYPE_MSZIP);
424  ok(res, "Failed to add file: %s\n", ptr);
425  ptr += lstrlenA(ptr) + 1;
426  }
427 
429  ok(res, "Failed to flush the cabinet\n");
430 
431  res = FCIDestroy(hfci);
432  ok(res, "Failed to destroy the cabinet\n");
433 }
static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
Definition: msi.c:391
static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
Definition: msi.c:332
static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
Definition: msi.c:293
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
static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
Definition: msi.c:305
static void CDECL mem_free(void *memory)
Definition: msi.c:235
BOOL __cdecl FCIDestroy(HFCI hfci)
Definition: fci.c:1709
Definition: fci.h:144
static void *CDECL mem_alloc(ULONG cb)
Definition: msi.c:230
#define tcompTYPE_MSZIP
Definition: fci.h:65
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: fci.h:44
static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
Definition: msi.c:281
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 int CDECL fci_delete(char *pszFile, int *err, void *pv)
Definition: msi.c:324
static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
Definition: msi.c:257
double __cdecl erf(double)
static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
Definition: msi.c:313
static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
Definition: msi.c:376
static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile, BOOL fContinuation, void *pv)
Definition: msi.c:251
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
Definition: msi.c:246
#define ok(value,...)
Definition: atltest.h:57
Definition: name.c:36
GLuint res
Definition: glext.h:9613
static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
Definition: msi.c:240

Referenced by create_test_files(), and test_lastusedsource().

◆ create_database_wordcount()

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

Definition at line 1093 of file msi.c.

1096 {
1097  MSIHANDLE db;
1098  UINT r;
1099  WCHAR *nameW;
1100  int j, len;
1101 
1102  len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
1103  if (!(nameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return;
1104  MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, len );
1105 
1107  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1108 
1109  /* import the tables into the database */
1110  for (j = 0; j < num_tables; j++)
1111  {
1112  const msi_table *table = &tables[j];
1113 
1114  write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
1115 
1116  r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
1117  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1118 
1119  DeleteFileA(table->filename);
1120  }
1121 
1122  write_msi_summary_info(db, version, wordcount, template);
1123 
1124  r = MsiDatabaseCommit(db);
1125  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1126 
1127  MsiCloseHandle(db);
1128  HeapFree( GetProcessHeap(), 0, nameW );
1129 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static void write_file(const CHAR *filename, const char *data, int data_size)
Definition: msi.c:1046
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define CP_ACP
Definition: compat.h:99
static const msi_table tables[]
Definition: msi.c:920
unsigned long MSIHANDLE
Definition: msiserver.idl:25
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR version[]
Definition: asmname.c:64
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
static const WCHAR nameW[]
Definition: main.c:46
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MSIDBOPEN_CREATE
Definition: msiquery.h:69
static void write_msi_summary_info(MSIHANDLE db, INT version, INT wordcount, const char *template)
Definition: msi.c:1056
GLenum GLsizei len
Definition: glext.h:6722
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
static char CURR_DIR[MAX_PATH]
Definition: msi.c:39
BYTE * data
UINT WINAPI MsiDatabaseCommit(MSIHANDLE hdb)
Definition: msiquery.c:813
#define ok(value,...)
Definition: atltest.h:57
UINT WINAPI MsiOpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIHANDLE *phDB)
Definition: database.c:303
unsigned int UINT
Definition: ndis.h:50
#define MultiByteToWideChar
Definition: compat.h:100
Definition: name.c:36
#define HeapFree(x, y, z)
Definition: compat.h:394
UINT WINAPI MsiDatabaseImportA(MSIHANDLE handle, LPCSTR szFolder, LPCSTR szFilename)
Definition: database.c:900

◆ create_file()

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

Definition at line 1431 of file msi.c.

1432 {
1433  HANDLE file;
1434  DWORD written;
1435 
1437  ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
1438  WriteFile(file, data, strlen(data), &written, NULL);
1439 
1440  if (size)
1441  {
1443  SetEndOfFile(file);
1444  }
1445 
1446  CloseHandle(file);
1447 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
#define CloseHandle
Definition: compat.h:398
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
BOOL WINAPI SetEndOfFile(HANDLE hFile)
Definition: fileinfo.c:1154
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI DECLSPEC_HOTPATCH SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod)
Definition: fileinfo.c:204
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
const char file[]
Definition: icontest.c:11
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define CREATE_ALWAYS
Definition: disk.h:72
#define FILE_BEGIN
Definition: winbase.h:112
#define ok(value,...)
Definition: atltest.h:57
Definition: name.c:36
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399
Definition: fci.c:126

Referenced by create_test_files(), test_concurrentinstall(), test_lastusedsource(), test_MsiConfigureProductEx(), test_MsiGetComponentPath(), test_MsiGetComponentPathEx(), test_MsiGetFileHash(), test_MsiGetFileSignatureInformation(), test_MsiGetFileVersion(), test_MsiProvideComponent(), test_MsiProvideQualifiedComponentEx(), test_setpropertyfolder(), and test_sourcedir_props().

◆ create_package_db()

static MSIHANDLE create_package_db ( LPSTR  prodcode)
static

Definition at line 1191 of file msi.c.

1192 {
1193  MSIHANDLE hdb = 0;
1194  CHAR query[MAX_PATH];
1195  UINT res;
1196 
1198 
1199  /* create an empty database */
1201  ok( res == ERROR_SUCCESS , "Failed to create database\n" );
1202  if (res != ERROR_SUCCESS)
1203  return hdb;
1204 
1205  res = MsiDatabaseCommit(hdb);
1206  ok(res == ERROR_SUCCESS, "Failed to commit database\n");
1207 
1208  set_summary_info(hdb, prodcode);
1209 
1210  res = run_query(hdb,
1211  "CREATE TABLE `Directory` ( "
1212  "`Directory` CHAR(255) NOT NULL, "
1213  "`Directory_Parent` CHAR(255), "
1214  "`DefaultDir` CHAR(255) NOT NULL "
1215  "PRIMARY KEY `Directory`)");
1216  ok(res == ERROR_SUCCESS , "Failed to create directory table\n");
1217 
1218  res = run_query(hdb,
1219  "CREATE TABLE `Property` ( "
1220  "`Property` CHAR(72) NOT NULL, "
1221  "`Value` CHAR(255) "
1222  "PRIMARY KEY `Property`)");
1223  ok(res == ERROR_SUCCESS , "Failed to create directory table\n");
1224 
1225  sprintf(query, "INSERT INTO `Property` "
1226  "(`Property`, `Value`) "
1227  "VALUES( 'ProductCode', '%s' )", prodcode);
1228  res = run_query(hdb, query);
1229  ok(res == ERROR_SUCCESS , "Failed\n");
1230 
1231  res = MsiDatabaseCommit(hdb);
1232  ok(res == ERROR_SUCCESS, "Failed to commit database\n");
1233 
1234  return hdb;
1235 }
#define ERROR_SUCCESS
Definition: deptool.c:10
char CHAR
Definition: xmlstorage.h:175
unsigned long MSIHANDLE
Definition: msiserver.idl:25
#define sprintf(buf, format,...)
Definition: sprintf.c:55
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
static UINT set_summary_info(MSIHANDLE hdb, LPSTR prodcode)
Definition: msi.c:1147
#define MAX_PATH
Definition: compat.h:26
#define MSIDBOPEN_CREATE
Definition: msiquery.h:69
static const char msifile[]
Definition: msi.c:37
static UINT run_query(MSIHANDLE hdb, const char *query)
Definition: msi.c:1131
UINT WINAPI MsiDatabaseCommit(MSIHANDLE hdb)
Definition: msiquery.c:813
#define ok(value,...)
Definition: atltest.h:57
UINT WINAPI MsiOpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIHANDLE *phDB)
Definition: database.c:303
unsigned int UINT
Definition: ndis.h:50
GLuint res
Definition: glext.h:9613
static const WCHAR msifileW[]
Definition: msi.c:38

Referenced by test_MsiOpenProduct().

◆ create_test_files()

static void create_test_files ( void  )
static

Definition at line 1449 of file msi.c.

1450 {
1451  CreateDirectoryA("msitest", NULL);
1452  create_file("msitest\\one.txt", "msitest\\one.txt", 100);
1453  CreateDirectoryA("msitest\\first", NULL);
1454  create_file("msitest\\first\\two.txt", "msitest\\first\\two.txt", 100);
1455  CreateDirectoryA("msitest\\second", NULL);
1456  create_file("msitest\\second\\three.txt", "msitest\\second\\three.txt", 100);
1457 
1458  create_file("four.txt", "four.txt", 100);
1459  create_file("five.txt", "five.txt", 100);
1460  create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
1461 
1462  create_file("msitest\\filename", "msitest\\filename", 100);
1463  create_file("msitest\\service.exe", "msitest\\service.exe", 100);
1464 
1465  DeleteFileA("four.txt");
1466  DeleteFileA("five.txt");
1467 }
#define MEDIA_SIZE
Definition: msi.c:225
static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
Definition: msi.c:404
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_file(LPCSTR name, LPCSTR data, DWORD size)
Definition: msi.c:1431

Referenced by test_command_line_parsing(), test_MsiProvideComponent(), and test_sourcedir_props().

◆ create_test_guid()

static void create_test_guid ( LPSTR  prodcode,
LPSTR  squashed 
)
static

Definition at line 1610 of file msi.c.

1611 {
1612  WCHAR guidW[MAX_PATH];
1613  WCHAR squashedW[MAX_PATH];
1614  GUID guid;
1615  HRESULT hr;
1616  int size;
1617 
1618  hr = CoCreateGuid(&guid);
1619  ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
1620 
1621  size = StringFromGUID2(&guid, guidW, MAX_PATH);
1622  ok(size == 39, "Expected 39, got %d\n", hr);
1623 
1624  WideCharToMultiByte(CP_ACP, 0, guidW, size, prodcode, MAX_PATH, NULL, NULL);
1625  if (squashed)
1626  {
1627  squash_guid(guidW, squashedW);
1628  WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
1629  }
1630 }
#define WideCharToMultiByte
Definition: compat.h:101
HRESULT hr
Definition: shlfolder.c:183
#define CP_ACP
Definition: compat.h:99
const GUID * guid
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2343
HRESULT WINAPI CoCreateGuid(GUID *pguid)
Definition: compobj.c:2115
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
DWORD size
Definition: msi.c:1488
static BOOL squash_guid(LPCWSTR in, LPWSTR out)
Definition: msi.c:1578

Referenced by test_MsiEnumClients(), test_MsiEnumComponents(), test_MsiEnumComponentsEx(), test_MsiEnumPatches(), test_MsiEnumPatchesEx(), test_MsiEnumPatchesEx_machine(), test_MsiEnumPatchesEx_usermanaged(), test_MsiEnumPatchesEx_userunmanaged(), test_MsiEnumProducts(), test_MsiEnumProductsEx(), test_MsiGetComponentPath(), test_MsiGetComponentPathEx(), test_MsiGetPatchInfo(), test_MsiGetPatchInfoEx(), test_MsiGetProductCode(), test_MsiGetProductInfoEx(), test_MsiGetUserInfo(), test_MsiOpenProduct(), test_MsiProvideQualifiedComponentEx(), test_MsiQueryComponentState(), test_MsiQueryFeatureState(), and test_MsiQueryProductState().

◆ delete_cab_files()

static void delete_cab_files ( void  )
static

Definition at line 472 of file msi.c.

473 {
474  SHFILEOPSTRUCTA shfl;
475  CHAR path[MAX_PATH+10];
476 
478  lstrcatA(path, "\\*.cab");
479  path[strlen(path) + 1] = '\0';
480 
481  shfl.hwnd = NULL;
482  shfl.wFunc = FO_DELETE;
483  shfl.pFrom = path;
484  shfl.pTo = NULL;
486 
487  SHFileOperationA(&shfl);
488 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLsizei const GLchar ** path
Definition: glext.h:7234
FILEOP_FLAGS fFlags
Definition: shellapi.h:347
#define FOF_SILENT
Definition: shellapi.h:140
char CHAR
Definition: xmlstorage.h:175
#define FOF_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
static char CURR_DIR[MAX_PATH]
Definition: msi.c:39
Definition: services.c:325
int WINAPI SHFileOperationA(LPSHFILEOPSTRUCTA lpFileOp)
Definition: shlfileop.cpp:1000
#define FO_DELETE
Definition: shellapi.h:135

Referenced by test_lastusedsource().

◆ delete_key()

◆ delete_pf()

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

Definition at line 170 of file msi.c.

171 {
172  char path[MAX_PATH];
173 
175  lstrcatA(path, "\\");
176  lstrcatA(path, rel_path);
177 
178  if (is_file)
179  return DeleteFileA(path);
180  else
181  return RemoveDirectoryA(path);
182 }
static char PROG_FILES_DIR[MAX_PATH]
Definition: msi.c:40
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
#define MAX_PATH
Definition: compat.h:26
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
Definition: services.c:325
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714

Referenced by test_concurrentinstall(), test_MsiConfigureProductEx(), test_setpropertyfolder(), and test_sourcedir_props().

◆ delete_test_files()

static void delete_test_files ( void  )
static

Definition at line 1469 of file msi.c.

1470 {
1471  DeleteFileA("msitest.msi");
1472  DeleteFileA("msitest.cab");
1473  DeleteFileA("msitest\\second\\three.txt");
1474  DeleteFileA("msitest\\first\\two.txt");
1475  DeleteFileA("msitest\\one.txt");
1476  DeleteFileA("msitest\\service.exe");
1477  DeleteFileA("msitest\\filename");
1478  RemoveDirectoryA("msitest\\second");
1479  RemoveDirectoryA("msitest\\first");
1480  RemoveDirectoryA("msitest");
1481 }
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714

Referenced by test_command_line_parsing(), test_MsiProvideComponent(), and test_sourcedir_props().

◆ encode_base85_guid()

static void encode_base85_guid ( GUID guid,
LPWSTR  str 
)
static

Definition at line 1956 of file msi.c.

1957 {
1958  unsigned int x, *p, i;
1959 
1960  p = (unsigned int*) guid;
1961  for( i=0; i<4; i++ )
1962  {
1963  x = p[i];
1964  *str++ = table_enc85[x%85];
1965  x = x/85;
1966  *str++ = table_enc85[x%85];
1967  x = x/85;
1968  *str++ = table_enc85[x%85];
1969  x = x/85;
1970  *str++ = table_enc85[x%85];
1971  x = x/85;
1972  *str++ = table_enc85[x%85];
1973  }
1974  *str = 0;
1975 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
static const char table_enc85[]
Definition: msi.c:1947
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
const GUID * guid
const WCHAR * str
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by compose_base85_guid().

◆ fci_close()

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

Definition at line 305 of file msi.c.

306 {
307  HANDLE handle = (HANDLE)hf;
308  ok(CloseHandle(handle), "Failed to CloseHandle\n");
309 
310  return 0;
311 }
#define CloseHandle
Definition: compat.h:398
PVOID HANDLE
Definition: typedefs.h:71
#define ok(value,...)
Definition: atltest.h:57

Referenced by create_cab_file().

◆ fci_delete()

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

Definition at line 324 of file msi.c.

325 {
326  BOOL ret = DeleteFileA(pszFile);
327  ok(ret, "Failed to DeleteFile %s\n", pszFile);
328 
329  return 0;
330 }
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
int ret
#define ok(value,...)
Definition: atltest.h:57

Referenced by create_cab_file().

◆ fci_open()

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

Definition at line 257 of file msi.c.

258 {
259  HANDLE handle;
260  DWORD dwAccess = 0;
261  DWORD dwShareMode = 0;
262  DWORD dwCreateDisposition = OPEN_EXISTING;
263 
264  dwAccess = GENERIC_READ | GENERIC_WRITE;
265  /* FILE_SHARE_DELETE is not supported by Windows Me/98/95 */
266  dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
267 
269  dwCreateDisposition = OPEN_EXISTING;
270  else
271  dwCreateDisposition = CREATE_NEW;
272 
273  handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
274  dwCreateDisposition, 0, NULL);
275 
276  ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
277 
278  return (INT_PTR)handle;
279 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
int32_t INT_PTR
Definition: typedefs.h:62
#define FILE_SHARE_READ
Definition: compat.h:125
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:786
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:426
unsigned long DWORD
Definition: ntddk_ex.h:95
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define GENERIC_READ
Definition: compat.h:124
#define ok(value,...)
Definition: atltest.h:57
#define CREATE_NEW
Definition: disk.h:69
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399

Referenced by create_cab_file().

◆ fci_read()

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

Definition at line 281 of file msi.c.

282 {
283  HANDLE handle = (HANDLE)hf;
284  DWORD dwRead;
285  BOOL res;
286 
287  res = ReadFile(handle, memory, cb, &dwRead, NULL);
288  ok(res, "Failed to ReadFile\n");
289 
290  return dwRead;
291 }
static char memory[1024 *256]
Definition: process.c:116
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
PVOID HANDLE
Definition: typedefs.h:71
static DWORD cb
Definition: integrity.c:41
#define ok(value,...)
Definition: atltest.h:57
GLuint res
Definition: glext.h:9613
BOOL WINAPI ReadFile(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead, OUT LPDWORD lpNumberOfBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:123

Referenced by create_cab_file().

◆ fci_seek()

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

Definition at line 313 of file msi.c.

314 {
315  HANDLE handle = (HANDLE)hf;
316  DWORD ret;
317 
318  ret = SetFilePointer(handle, dist, NULL, seektype);
319  ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
320 
321  return ret;
322 }
#define INVALID_SET_FILE_POINTER
Definition: winbase.h:115
DWORD WINAPI DECLSPEC_HOTPATCH SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod)
Definition: fileinfo.c:204
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
PVOID HANDLE
Definition: typedefs.h:71
int ret
#define ok(value,...)
Definition: atltest.h:57

Referenced by create_cab_file().

◆ fci_write()

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

Definition at line 293 of file msi.c.

294 {
295  HANDLE handle = (HANDLE)hf;
296  DWORD dwWritten;
297  BOOL res;
298 
299  res = WriteFile(handle, memory, cb, &dwWritten, NULL);
300  ok(res, "Failed to WriteFile\n");
301 
302  return dwWritten;
303 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
static char memory[1024 *256]
Definition: process.c:116
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
PVOID HANDLE
Definition: typedefs.h:71
static DWORD cb
Definition: integrity.c:41
#define ok(value,...)
Definition: atltest.h:57
GLuint res
Definition: glext.h:9613

Referenced by create_cab_file().

◆ file_exists()

static BOOL file_exists ( const char file)
static

Definition at line 155 of file msi.c.

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

Referenced by pf_exists().

◆ file_placed()

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

Definition at line 251 of file msi.c.

253 {
254  return 0;
255 }

Referenced by create_cab_file().

◆ get_next_cabinet()

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

Definition at line 240 of file msi.c.

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

Referenced by add_file(), and create_cab_file().

◆ get_open_info()

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

Definition at line 351 of file msi.c.

353 {
356  HANDLE handle;
357  DWORD attrs;
358  BOOL res;
359 
362  ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
363 
365  ok(res, "Expected GetFileInformationByHandle to succeed\n");
366 
368  FileTimeToDosDateTime(&filetime, pdate, ptime);
369 
370  attrs = GetFileAttributesA(pszName);
371  ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
372 
373  return (INT_PTR)handle;
374 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
int32_t INT_PTR
Definition: typedefs.h:62
BOOL WINAPI FileTimeToLocalFileTime(IN CONST FILETIME *lpFileTime, OUT LPFILETIME lpLocalFileTime)
Definition: time.c:211
#define FILE_SHARE_READ
Definition: compat.h:125
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:786
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:426
BOOL WINAPI GetFileInformationByHandle(HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation)
Definition: fileinfo.c:608
unsigned long DWORD
Definition: ntddk_ex.h:95
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define GENERIC_READ
Definition: compat.h:124
BOOL WINAPI FileTimeToDosDateTime(IN CONST FILETIME *lpFileTime, OUT LPWORD lpFatDate, OUT LPWORD lpFatTime)
Definition: time.c:37
#define FILE_FLAG_SEQUENTIAL_SCAN
Definition: disk.h:43
#define ok(value,...)
Definition: atltest.h:57
GLuint res
Definition: glext.h:9613
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399

Referenced by add_file().

◆ get_system_dirs()

static BOOL get_system_dirs ( void  )
static

Definition at line 122 of file msi.c.

123 {
124  HKEY hkey;
125  DWORD type, size;
126 
127  if (RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion", &hkey))
128  return FALSE;
129 
130  size = MAX_PATH;
131  if (RegQueryValueExA(hkey, "ProgramFilesDir (x86)", 0, &type, (LPBYTE)PROG_FILES_DIR, &size) &&
132  RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR, &size))
133  {
134  RegCloseKey(hkey);
135  return FALSE;
136  }
137  size = MAX_PATH;
138  if (RegQueryValueExA(hkey, "CommonFilesDir (x86)", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size) &&
139  RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size))
140  {
141  RegCloseKey(hkey);
142  return FALSE;
143  }
144  size = MAX_PATH;
145  if (RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR_NATIVE, &size))
146  {
147  RegCloseKey(hkey);
148  return FALSE;
149  }
150  RegCloseKey(hkey);
152  return TRUE;
153 }
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3257
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4023
#define TRUE
Definition: types.h:120
static char PROG_FILES_DIR[MAX_PATH]
Definition: msi.c:40
static char PROG_FILES_DIR_NATIVE[MAX_PATH]
Definition: msi.c:41
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
static char COMMON_FILES_DIR[MAX_PATH]
Definition: msi.c:42
GLsizeiptr size
Definition: glext.h:5919
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
static char WINDOWS_DIR[MAX_PATH]
Definition: msi.c:43
UINT WINAPI GetWindowsDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2336
DWORD size
Definition: msi.c:1488
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by START_TEST().

◆ get_temp_file()

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

Definition at line 332 of file msi.c.

333 {
334  LPSTR tempname;
335 
336  tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
337  GetTempFileNameA(".", "xx", 0, tempname);
338 
339  if (tempname && (strlen(tempname) < (unsigned)cbTempName))
340  {
341  lstrcpyA(pszTempName, tempname);
342  HeapFree(GetProcessHeap(), 0, tempname);
343  return TRUE;
344  }
345 
346  HeapFree(GetProcessHeap(), 0, tempname);
347 
348  return FALSE;
349 }
#define TRUE
Definition: types.h:120
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * LPSTR
Definition: xmlstorage.h:182
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define MAX_PATH
Definition: compat.h:26
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
Definition: filename.c:26
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by create_cab_file().

◆ get_user_sid()

static char* get_user_sid ( void  )
static

Definition at line 1632 of file msi.c.

1633 {
1634  HANDLE token;
1635  DWORD size = 0;
1636  TOKEN_USER *user;
1637  char *usersid = NULL;
1638 
1641 
1642  user = HeapAlloc(GetProcessHeap(), 0, size);
1644  pConvertSidToStringSidA(user->User.Sid, &usersid);
1645  HeapFree(GetProcessHeap(), 0, user);
1646 
1647  CloseHandle(token);
1648  return usersid;
1649 }
#define CloseHandle
Definition: compat.h:398
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define TOKEN_QUERY
Definition: setypes.h:874
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1138
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:413
void user(int argc, const char *argv[])
Definition: cmds.c:1350
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by test_MsiEnumClients(), test_MsiEnumComponents(), test_MsiEnumComponentsEx(), test_MsiEnumPatches(), test_MsiEnumPatchesEx(), test_MsiEnumProducts(), test_MsiEnumProductsEx(), test_MsiGetComponentPath(), test_MsiGetComponentPathEx(), test_MsiGetPatchInfoEx(), test_MsiGetProductCode(), test_MsiGetProductInfoEx(), test_MsiGetUserInfo(), test_MsiOpenProduct(), test_MsiQueryComponentState(), test_MsiQueryFeatureState(), and test_MsiQueryProductState().

◆ get_version_info()

static void get_version_info ( LPSTR  path,
LPSTR vercheck,
LPDWORD  verchecksz,
LPSTR langcheck,
LPDWORD  langchecksz 
)
static

Definition at line 4451 of file msi.c.

4453 {
4454  LPSTR version;
4455  VS_FIXEDFILEINFO *ffi;
4457  USHORT *lang;
4458 
4461 
4462  VerQueryValueA(version, "\\", (LPVOID *)&ffi, &size);
4463  *vercheck = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
4464  sprintf(*vercheck, "%d.%d.%d.%d", HIWORD(ffi->dwFileVersionMS),
4466  LOWORD(ffi->dwFileVersionLS));
4467  *verchecksz = lstrlenA(*vercheck);
4468 
4469  VerQueryValueA(version, "\\VarFileInfo\\Translation", (void **)&lang, &size);
4470  *langcheck = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
4471  sprintf(*langcheck, "%d", *lang);
4472  *langchecksz = lstrlenA(*langcheck);
4473 
4475 }
DWORD dwFileVersionLS
Definition: compat.h:552
BOOL WINAPI VerQueryValueA(LPCVOID pBlock, LPCSTR lpSubBlock, LPVOID *lplpBuffer, PUINT puLen)
Definition: version.c:998
char * LPSTR
Definition: xmlstorage.h:182
#define sprintf(buf, format,...)
Definition: sprintf.c:55
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR version[]
Definition: asmname.c:64
static const WCHAR lang[]
Definition: wbemdisp.c:287
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
DWORD WINAPI GetFileVersionInfoSizeA(LPCSTR filename, LPDWORD handle)
Definition: version.c:624
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD dwFileVersionMS
Definition: compat.h:551
BOOL WINAPI GetFileVersionInfoA(LPCSTR filename, DWORD handle, DWORD datasize, LPVOID data)
Definition: version.c:858
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
unsigned short USHORT
Definition: pedump.c:61
Definition: services.c:325
#define HIWORD(l)
Definition: typedefs.h:246
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by test_MsiGetFileVersion().

◆ handler_a()

static INT CALLBACK handler_a ( LPVOID  context,
UINT  type,
LPCSTR  msg 
)
static

Definition at line 14338 of file msi.c.

14339 {
14340  return IDOK;
14341 }
#define IDOK
Definition: winuser.h:824

Referenced by test_MsiSetExternalUI().

◆ handler_record()

static INT CALLBACK handler_record ( LPVOID  context,
UINT  type,
MSIHANDLE  record 
)
static

Definition at line 14348 of file msi.c.

14349 {
14350  return IDOK;
14351 }
#define IDOK
Definition: winuser.h:824

Referenced by test_MsiSetExternalUI().

◆ handler_w()

static INT CALLBACK handler_w ( LPVOID  context,
UINT  type,
LPCWSTR  msg 
)
static

Definition at line 14343 of file msi.c.

14344 {
14345  return IDOK;
14346 }
#define IDOK
Definition: winuser.h:824

Referenced by test_MsiSetExternalUI().

◆ init_functionpointers()

static void init_functionpointers ( void  )
static

Definition at line 85 of file msi.c.

86 {
87  HMODULE hmsi = GetModuleHandleA("msi.dll");
88  HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
89  HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
90 
91 #define GET_PROC(dll, func) \
92  p ## func = (void *)GetProcAddress(dll, #func); \
93  if(!p ## func) \
94  trace("GetProcAddress(%s) failed\n", #func);
95 
112 
113  GET_PROC(hadvapi32, CheckTokenMembership);
114  GET_PROC(hadvapi32, ConvertSidToStringSidA)
115  GET_PROC(hadvapi32, OpenProcessToken);
116  GET_PROC(hadvapi32, RegDeleteKeyExA)
118 
119 #undef GET_PROC
120 }
INSTALLSTATE WINAPI MsiGetComponentPathExA(LPCSTR product, LPCSTR comp, LPCSTR usersid, MSIINSTALLCONTEXT ctx, LPSTR buf, LPDWORD buflen)
Definition: msi.c:2916
#define GET_PROC(dll, func)
LONG WINAPI RegDeleteKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ REGSAM samDesired, _In_ DWORD Reserved)
Definition: reg.c:1252
UINT WINAPI MsiProvideComponentW(LPCWSTR product, LPCWSTR feature, LPCWSTR component, DWORD mode, LPWSTR buf, LPDWORD buflen)
Definition: msi.c:4320
UINT WINAPI MsiGetPatchInfoExA(LPCSTR szPatchCode, LPCSTR szProductCode, LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext, LPCSTR szProperty, LPSTR lpValue, DWORD *pcchValue)
Definition: msi.c:1614
static HINSTANCE hkernel32
Definition: process.c:66
UINT WINAPI MsiEnumComponentsExA(LPCSTR user_sid, DWORD ctx, DWORD index, CHAR guid[39], MSIINSTALLCONTEXT *installed_ctx, LPSTR sid, LPDWORD sid_len)
Definition: registry.c:1256
BOOL WINAPI CheckTokenMembership(IN HANDLE ExistingTokenHandle, IN PSID SidToCheck, OUT PBOOL IsMember)
Definition: token.c:21
INSTALLSTATE WINAPI MsiGetComponentPathA(LPCSTR product, LPCSTR comp, LPSTR buf, LPDWORD buflen)
Definition: msi.c:2954
UINT WINAPI MsiOpenPackageExA(LPCSTR szPackage, DWORD dwOptions, MSIHANDLE *phPackage)
Definition: package.c:1668
UINT WINAPI MsiGetFileHashA(LPCSTR szFilePath, DWORD dwOptions, PMSIFILEHASHINFO pHash)
Definition: msi.c:4160
BOOL WINAPI IsWow64Process(IN HANDLE hProcess, OUT PBOOL Wow64Process)
Definition: proc.c:1974
UINT WINAPI MsiOpenPackageExW(LPCWSTR szPackage, DWORD dwOptions, MSIHANDLE *phPackage)
Definition: package.c:1630
UINT WINAPI MsiProvideComponentA(LPCSTR product, LPCSTR feature, LPCSTR component, DWORD mode, LPSTR buf, LPDWORD buflen)
Definition: msi.c:4274
UINT WINAPI MsiGetProductInfoExA(LPCSTR szProductCode, LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext, LPCSTR szProperty, LPSTR szValue, LPDWORD pcchValue)
Definition: msi.c:1316
UINT WINAPI MsiSetExternalUIRecord(INSTALLUI_HANDLER_RECORD handler, DWORD filter, LPVOID context, PINSTALLUI_HANDLER_RECORD prev)
Definition: msi.c:4224
BOOL WINAPI ConvertSidToStringSidA(PSID Sid, LPSTR *StringSid)
Definition: security.c:3313
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
INSTALLSTATE WINAPI MsiUseFeatureExA(LPCSTR szProduct, LPCSTR szFeature, DWORD dwInstallMode, DWORD dwReserved)
Definition: msi.c:3364
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
UINT WINAPI MsiSourceListGetInfoA(LPCSTR szProduct, LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, LPCSTR szProperty, LPSTR szValue, LPDWORD pcchValue)
Definition: source.c:485
UINT WINAPI MsiQueryComponentStateA(LPCSTR szProductCode, LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext, LPCSTR szComponent, INSTALLSTATE *pdwState)
Definition: msi.c:2081
UINT WINAPI MsiEnumPatchesExA(LPCSTR szProductCode, LPCSTR szUserSid, DWORD dwContext, DWORD dwFilter, DWORD dwIndex, LPSTR szPatchCode, LPSTR szTargetProductCode, MSIINSTALLCONTEXT *pdwTargetProductContext, LPSTR szTargetUserSid, LPDWORD pcchTargetUserSid)
Definition: registry.c:1769
UINT WINAPI MsiEnumProductsExA(LPCSTR product, LPCSTR usersid, DWORD ctx, DWORD index, CHAR installed_product[GUID_SIZE], MSIINSTALLCONTEXT *installed_ctx, LPSTR sid, LPDWORD sid_len)
Definition: registry.c:2274

Referenced by START_TEST().

◆ INSTALLSTATE()

static INSTALLSTATE ( WINAPI pMsiGetComponentPathA)
static

◆ is_process_limited()

static BOOL is_process_limited ( void  )
static

Definition at line 184 of file msi.c.

185 {
187  PSID Group = NULL;
188  BOOL IsInGroup;
189  HANDLE token;
190 
191  if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE;
192 
194  DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
195  !pCheckTokenMembership(NULL, Group, &IsInGroup))
196  {
197  trace("Could not check if the current user is an administrator\n");
198  FreeSid(Group);
199  return FALSE;
200  }
201  FreeSid(Group);
202 
203  if (!IsInGroup)
204  {
205  /* Only administrators have enough privileges for these tests */
206  return TRUE;
207  }
208 
209  if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
210  {
211  BOOL ret;
213  DWORD size;
214 
217  return (ret && type == TokenElevationTypeLimited);
218  }
219  return FALSE;
220 }
enum _TOKEN_ELEVATION_TYPE TOKEN_ELEVATION_TYPE
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
_In_opt_ PSID Group
Definition: rtlfuncs.h:1606
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
unsigned int BOOL
Definition: ntddk_ex.h:94
PVOID WINAPI FreeSid(PSID pSid)
Definition: security.c:577
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210
smooth NULL
Definition: ftsmooth.c:416
#define SECURITY_NT_AUTHORITY
Definition: setypes.h:526
GLsizeiptr size
Definition: glext.h:5919
#define trace
Definition: atltest.h:70
#define SECURITY_BUILTIN_DOMAIN_RID
Definition: setypes.h:553
#define TOKEN_QUERY
Definition: setypes.h:874
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1138
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
DWORD size
Definition: msi.c:1488
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:413
#define DOMAIN_ALIAS_RID_ADMINS
Definition: setypes.h:624
SID_IDENTIFIER_AUTHORITY NtAuthority
Definition: database.c:19
BOOL WINAPI AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount, DWORD nSubAuthority0, DWORD nSubAuthority1, DWORD nSubAuthority2, DWORD nSubAuthority3, DWORD nSubAuthority4, DWORD nSubAuthority5, DWORD nSubAuthority6, DWORD nSubAuthority7, PSID *pSid)
Definition: security.c:553

Referenced by test_command_line_parsing(), test_concurrentinstall(), test_MsiConfigureProductEx(), test_MsiGetFeatureInfo(), test_MsiProvideComponent(), test_MsiProvideQualifiedComponentEx(), test_MsiSetFeatureAttributes(), test_setpropertyfolder(), and test_sourcedir_props().

◆ LONG()

static LONG ( WINAPI pRegDeleteKeyExA)
static

◆ mem_alloc()

static void* CDECL mem_alloc ( ULONG  cb)
static

Definition at line 230 of file msi.c.

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

Referenced by create_cab_file().

◆ mem_free()

static void CDECL mem_free ( void memory)
static

Definition at line 235 of file msi.c.

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

Referenced by create_cab_file().

◆ pf_exists()

static BOOL pf_exists ( const char file)
static

Definition at line 160 of file msi.c.

161 {
162  char path[MAX_PATH];
163 
165  lstrcatA(path, "\\");
166  lstrcatA(path, file);
167  return file_exists(path);
168 }
static char PROG_FILES_DIR[MAX_PATH]
Definition: msi.c:40
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
static BOOL file_exists(const char *file)
Definition: msi.c:155
Definition: services.c:325
Definition: fci.c:126

Referenced by test_MsiConfigureProductEx().

◆ progress()

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

Definition at line 246 of file msi.c.

247 {
248  return 0;
249 }

Referenced by add_file(), and create_cab_file().

◆ run_query()

static UINT run_query ( MSIHANDLE  hdb,
const char query 
)
static

Definition at line 1131 of file msi.c.

1132 {
1133  MSIHANDLE hview = 0;
1134  UINT r;
1135 
1136  r = MsiDatabaseOpenViewA(hdb, query, &hview);
1137  if (r != ERROR_SUCCESS)
1138  return r;
1139 
1140  r = MsiViewExecute(hview, 0);
1141  if (r == ERROR_SUCCESS)
1142  r = MsiViewClose(hview);
1143  MsiCloseHandle(hview);
1144  return r;
1145 }
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

Referenced by create_package_db().

◆ set_cab_parameters()

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

Definition at line 391 of file msi.c.

392 {
393  ZeroMemory(pCabParams, sizeof(CCAB));
394 
395  pCabParams->cb = max_size;
396  pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
397  pCabParams->setID = 0xbeef;
398  pCabParams->iCab = 1;
399  lstrcpyA(pCabParams->szCabPath, CURR_DIR);
400  lstrcatA(pCabParams->szCabPath, "\\");
401  lstrcpyA(pCabParams->szCab, name);
402 }
ULONG cbFolderThresh
Definition: fci.h:146
#define ZeroMemory
Definition: winbase.h:1642
Definition: fci.h:144
int iCab
Definition: fci.h:151
char szCab[CB_MAX_CABINET_NAME]
Definition: fci.h:160
static INT max_size
Definition: history.c:51
ULONG cb
Definition: fci.h:145
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
#define FOLDER_THRESHOLD
Definition: msi.c:226
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
static char CURR_DIR[MAX_PATH]
Definition: msi.c:39
USHORT setID
Definition: fci.h:157
Definition: name.c:36
char szCabPath[CB_MAX_CAB_PATH]
Definition: fci.h:161

Referenced by create_cab_file().

◆ set_summary_info()

static UINT set_summary_info ( MSIHANDLE  hdb,
LPSTR  prodcode 
)
static

Definition at line 1147 of file msi.c.

1148 {
1149  UINT res;
1151 
1152  /* build summary info */
1154  ok(res == ERROR_SUCCESS, "Failed to open summaryinfo\n");
1155 
1157  "Installation Database");
1158  ok(res == ERROR_SUCCESS, "Failed to set summary info\n");
1159 
1161  "Installation Database");
1162  ok(res == ERROR_SUCCESS, "Failed to set summary info\n");
1163 
1165  "Wine Hackers");
1166  ok(res == ERROR_SUCCESS, "Failed to set summary info\n");
1167 
1169  ";1033");
1170  ok(res == ERROR_SUCCESS, "Failed to set summary info\n");
1171 
1173  "{A2078D65-94D6-4205-8DEE-F68D6FD622AA}");
1174  ok(res == ERROR_SUCCESS, "Failed to set summary info\n");
1175 
1177  ok(res == ERROR_SUCCESS, "Failed to set summary info\n");
1178 
1180  ok(res == ERROR_SUCCESS, "Failed to set summary info\n");
1181 
1183  ok(res == ERROR_SUCCESS, "Failed to make summary info persist\n");
1184 
1186  ok(res == ERROR_SUCCESS, "Failed to close suminfo\n");
1187 
1188  return res;
1189 }
Definition: compat.h:1939
#define ERROR_SUCCESS
Definition: deptool.c:10
#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
UINT WINAPI MsiGetSummaryInformationA(MSIHANDLE hDatabase, LPCSTR szDatabase, UINT uiUpdateCount, MSIHANDLE *pHandle)
Definition: suminfo.c:586
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
UINT WINAPI MsiSummaryInfoPersist(MSIHANDLE handle)
Definition: suminfo.c:1152
GLuint res
Definition: glext.h:9613

Referenced by create_package_db().

◆ squash_guid()

static BOOL squash_guid ( LPCWSTR  in,
LPWSTR  out 
)
static

Definition at line 1578 of file msi.c.

1579 {
1580  DWORD i,n=1;
1581  GUID guid;
1582 
1583  if (FAILED(CLSIDFromString((LPCOLESTR)in, &guid)))
1584  return FALSE;
1585 
1586  for(i=0; i<8; i++)
1587  out[7-i] = in[n++];
1588  n++;
1589  for(i=0; i<4; i++)
1590  out[11-i] = in[n++];
1591  n++;
1592  for(i=0; i<4; i++)
1593  out[15-i] = in[n++];
1594  n++;
1595  for(i=0; i<2; i++)
1596  {
1597  out[17+i*2] = in[n++];
1598  out[16+i*2] = in[n++];
1599  }
1600  n++;
1601  for( ; i<8; i++)
1602  {
1603  out[17+i*2] = in[n++];
1604  out[16+i*2] = in[n++];
1605  }
1606  out[32]=0;
1607  return TRUE;
1608 }
#define TRUE
Definition: types.h:120
GLdouble n
Definition: glext.h:7729
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
const GUID * guid
static FILE * out
Definition: regtests2xml.c:44
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint in
Definition: glext.h:9616
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2247

Referenced by compose_base85_guid(), create_test_guid(), MSI_GetComponentPath(), MSI_GetProductInfo(), MSI_GetUserInfo(), MsiGetPatchInfoExW(), MsiGetProductCodeW(), MsiGetProductInfoExW(), MsiOpenProductW(), MsiQueryComponentStateW(), MsiQueryFeatureStateExW(), and MsiQueryFeatureStateW().

◆ START_TEST()

START_TEST ( msi  )

Definition at line 14879 of file msi.c.

14880 {
14881  DWORD len;
14882  char temp_path[MAX_PATH], prev_path[MAX_PATH];
14883 
14884 #ifdef __REACTOS__
14885  if (!winetest_interactive &&
14886  !strcmp(winetest_platform, "windows"))
14887  {
14888  skip("ROSTESTS-180: Skipping msi_winetest:msi because it hangs on WHS-Testbot. Set winetest_interactive to run it anyway.\n");
14889  return;
14890  }
14891 #endif
14892 
14894 
14895  if (pIsWow64Process)
14896  pIsWow64Process(GetCurrentProcess(), &is_wow64);
14897 
14898  GetCurrentDirectoryA(MAX_PATH, prev_path);
14901 
14903  len = lstrlenA(CURR_DIR);
14904 
14905  if(len && (CURR_DIR[len - 1] == '\\'))
14906  CURR_DIR[len - 1] = 0;
14907 
14908  ok(get_system_dirs(), "failed to retrieve system dirs\n");
14909 
14910  test_usefeature();
14911  test_null();
14915 
14916  if (!pConvertSidToStringSidA)
14917  win_skip("ConvertSidToStringSidA not implemented\n");
14918  else
14919  {
14920  /* These tests rely on get_user_sid that needs ConvertSidToStringSidA */
14941  }
14951  if (pMsiGetComponentPathExA)
14955 
14956  SetCurrentDirectoryA(prev_path);
14957 }
static void test_MsiGetFileVersion(void)
Definition: msi.c:4477
static void test_MsiGetProductInfo(void)
Definition: msi.c:4748
static void test_MsiProvideQualifiedComponentEx(void)
Definition: msi.c:3847
static BOOL get_system_dirs(void)
Definition: msi.c:122
static void test_MsiEnumClients(void)
Definition: msi.c:4254
static void test_MsiQueryComponentState(void)
Definition: msi.c:2501
static void test_MsiGetUserInfo(void)
Definition: msi.c:8801
int winetest_interactive
static void test_MsiGetFeatureInfo(void)
Definition: msi.c:14255
static void test_usefeature(void)
Definition: msi.c:1237
static void test_MsiSetFeatureAttributes(void)
Definition: msi.c:14173
static void test_MsiOpenProduct(void)
Definition: msi.c:9391
static BOOL is_wow64
Definition: msi.c:36
static void test_MsiQueryProductState(void)
Definition: msi.c:1651
static void test_MsiEnumComponentsEx(void)
Definition: msi.c:13791
static void test_MsiEnumProductsEx(void)
Definition: msi.c:13562
static void test_MsiGetPatchInfoEx(void)
Definition: msi.c:12205
static void test_MsiEnumPatches(void)
Definition: msi.c:11497
const char * winetest_platform
static void test_MsiGetProductCode(void)
Definition: msi.c:3987
static void test_MsiSetInternalUI(void)
Definition: msi.c:14353
static void test_lastusedsource(void)
Definition: msi.c:14433
static void test_MsiGetProductInfoEx(void)
Definition: msi.c:6040
static void test_MsiGetFileSignatureInformation(void)
Definition: msi.c:13519
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1138
static void test_MsiGetComponentPath(void)
Definition: msi.c:2891
#define MAX_PATH
Definition: compat.h:26
static void test_null(void)
Definition: msi.c:1283
static void test_MsiConfigureProductEx(void)
Definition: msi.c:13888
unsigned long DWORD
Definition: ntddk_ex.h:95
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
BOOL WINAPI SetCurrentDirectoryA(IN LPCSTR lpPathName)
Definition: path.c:2205
GLenum GLsizei len
Definition: glext.h:6722
static void test_MsiGetComponentPathEx(void)
Definition: msi.c:3432
static void test_getcomponentpath(void)
Definition: msi.c:1391
static void test_MsiGetFileHash(void)
Definition: msi.c:1517
static void test_sourcedir_props(void)
Definition: msi.c:14604
static void test_MsiQueryFeatureState(void)
Definition: msi.c:1999
static char CURR_DIR[MAX_PATH]
Definition: msi.c:39
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
static void test_command_line_parsing(void)
Definition: msi.c:14719
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2053
static void test_MsiEnumComponents(void)
Definition: msi.c:13725
static void test_MsiEnumProducts(void)
Definition: msi.c:13436
static void init_functionpointers(void)
Definition: msi.c:85
#define ok(value,...)
Definition: atltest.h:57
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2145
#define skip(...)
Definition: atltest.h:64
static void test_MsiEnumPatchesEx(void)
Definition: msi.c:11236
static void test_concurrentinstall(void)
Definition: msi.c:14667
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
static void test_MsiGetPatchInfo(void)
Definition: msi.c:13243
static void test_MsiProvideComponent(void)
Definition: msi.c:3753
#define win_skip
Definition: test.h:141
static void test_MsiSetExternalUI(void)
Definition: msi.c:14370
static void test_setpropertyfolder(void)
Definition: msi.c:14555
char temp_path[MAX_PATH]
Definition: mspatcha.c:123

◆ test_command_line_parsing()

static void test_command_line_parsing ( void  )
static

Definition at line 14719 of file msi.c.

14720 {
14721  UINT r;
14722  const char *cmd;
14723 
14724  if (is_process_limited())
14725  {
14726  skip("process is limited\n");
14727  return;
14728  }
14729 
14732 
14734 
14735  cmd = " ";
14737  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
14738 
14739  cmd = "=";
14741  ok(r == ERROR_INVALID_COMMAND_LINE, "Expected ERROR_INVALID_COMMAND_LINE, got %u\n", r);
14742 
14743  cmd = "==";
14745  ok(r == ERROR_INVALID_COMMAND_LINE, "Expected ERROR_INVALID_COMMAND_LINE, got %u\n", r);
14746 
14747  cmd = "one";
14749  ok(r == ERROR_INVALID_COMMAND_LINE, "Expected ERROR_INVALID_COMMAND_LINE, got %u\n", r);
14750 
14751  cmd = "=one";
14753  ok(r == ERROR_INVALID_COMMAND_LINE, "Expected ERROR_INVALID_COMMAND_LINE, got %u\n", r);
14754 
14755  cmd = "P=";
14757  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
14758 
14759  cmd = " P=";
14761  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
14762 
14763  cmd = "P= ";
14765  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
14766 
14767  cmd = "P=\"";
14769  ok(r == ERROR_INVALID_COMMAND_LINE, "Expected ERROR_INVALID_COMMAND_LINE, got %u\n", r);
14770 
14771  cmd = "P=\"\"";
14773  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
14774 
14775  cmd = "P=\"\"\"";
14777  ok(r == ERROR_INVALID_COMMAND_LINE, "Expected ERROR_INVALID_COMMAND_LINE, got %u\n", r);
14778 
14779  cmd = "P=\"\"\"\"";
14781  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
14782 
14783  cmd = "P=\" ";
14785  ok(r == ERROR_INVALID_COMMAND_LINE, "Expected ERROR_INVALID_COMMAND_LINE, got %u\n", r);
14786 
14787  cmd = "P= \"";
14789  ok(r == ERROR_INVALID_COMMAND_LINE, "Expected ERROR_INVALID_COMMAND_LINE, got %u\n", r);
14790 
14791  cmd = "P= \"\" ";
14793  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
14794 
14795  cmd = "P=\" \"";
14797  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
14798 
14799  cmd = "P=one";
14801  ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
14802 
14803  cmd = "P= one";
14805  ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
14806 
14807  cmd = "P=\"one";
14809  ok(r == ERROR_INVALID_COMMAND_LINE, "Expected ERROR_INVALID_COMMAND_LINE, got %u\n", r);
14810 
14811  cmd = "P=one\"";
14813  todo_wine ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
14814 
14815  cmd = "P=\"one\"";
14817  ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
14818 
14819  cmd = "P= \"one\" ";
14821  ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
14822 
14823  cmd = "P=\"one\"\"";
14825  ok(r == ERROR_INVALID_COMMAND_LINE, "Expected ERROR_INVALID_COMMAND_LINE, got %u\n", r);
14826 
14827  cmd = "P=\"\"one\"";
14829  ok(r == ERROR_INVALID_COMMAND_LINE, "Expected ERROR_INVALID_COMMAND_LINE, got %u\n", r);
14830 
14831  cmd = "P=\"\"one\"\"";
14833  todo_wine ok(r == ERROR_INVALID_COMMAND_LINE, "Expected ERROR_INVALID_COMMAND_LINE, got %u\n", r);
14834 
14835  cmd = "P=\"one two\"";
14837  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
14838 
14839  cmd = "P=\"\"\"one\"\" two\"";
14841  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
14842 
14843  cmd = "P=\"\"\"one\"\" two\" Q=three";
14845  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
14846 
14847  cmd = "P=\"\" Q=\"two\"";
14849  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
14850 
14851  cmd = "P=\"one\" Q=\"two\"";
14853  ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
14854 
14855  cmd = "P=\"one=two\"";
14857  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
14858 
14859  cmd = "Q=\"\" P=\"one\"";
14861  ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
14862 
14863  cmd = "P=\"\"\"one\"\"\" Q=\"two\"";
14865  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
14866 
14867  cmd = "P=\"one \"\"two\"\"\" Q=\"three\"";
14869  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
14870 
14871  cmd = "P=\"\"\"one\"\" two\" Q=\"three\"";
14873  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
14874 
14877 }
#define ERROR_SUCCESS
Definition: deptool.c:10
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:205
Definition: ftp_var.h:139
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static BOOL is_process_limited(void)
Definition: msi.c:184
char * cmd
Definition: vfdcmd.c:85
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2313
#define ERROR_INVALID_COMMAND_LINE
Definition: winerror.h:997
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define ERROR_INSTALL_FAILURE
Definition: winerror.h:961
static const msi_table cl_tables[]
Definition: msi.c:1033
#define todo_wine
Definition: test.h:154
static const char msifile[]
Definition: msi.c:37
#define create_database(name, tables, num_tables)
Definition: msi.c:1087
static void create_test_files(void)
Definition: msi.c:1449
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
#define skip(...)
Definition: atltest.h:64
static void delete_test_files(void)
Definition: msi.c:1469

Referenced by START_TEST().

◆ test_concurrentinstall()

static void test_concurrentinstall ( void  )
static

Definition at line 14667 of file msi.c.

14668 {
14669  UINT r;
14670  CHAR path[MAX_PATH];
14671 
14672  if (is_process_limited())
14673  {
14674  skip("process is limited\n");
14675  return;
14676  }
14677 
14678  CreateDirectoryA("msitest", NULL);
14679  CreateDirectoryA("msitest\\msitest", NULL);
14680  create_file("msitest\\maximus", "msitest\\maximus", 500);
14681  create_file("msitest\\msitest\\augustus", "msitest\\msitest\\augustus", 500);
14682 
14683  create_database(msifile, ci_tables, sizeof(ci_tables) / sizeof(msi_table));
14684 
14686  lstrcatA(path, "\\msitest\\concurrent.msi");
14687  create_database(path, ci2_tables, sizeof(ci2_tables) / sizeof(msi_table));
14688 
14690 
14693  {
14694  skip("Not enough rights to perform tests\n");
14695  goto error;
14696  }
14697  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
14698  ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
14699  ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
14700  ok(delete_pf("msitest", FALSE), "Directory not created\n");
14701 
14702  r = MsiConfigureProductA("{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}", INSTALLLEVEL_DEFAULT,
14704  ok(r == ERROR_SUCCESS, "got %u\n", r);
14705 
14706  r = MsiConfigureProductA("{FF4AFE9C-6AC2-44F9-A060-9EA6BD16C75E}", INSTALLLEVEL_DEFAULT,
14708  ok(r == ERROR_SUCCESS, "got %u\n", r);
14709 
14710 error:
14711  DeleteFileA(path);
14713  DeleteFileA("msitest\\msitest\\augustus");
14714  DeleteFileA("msitest\\maximus");
14715  RemoveDirectoryA("msitest\\msitest");
14716  RemoveDirectoryA("msitest");
14717 }
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define error(str)
Definition: mkdosfs.c:1605
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:205
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
char CHAR
Definition: xmlstorage.h:175
static BOOL is_process_limited(void)
Definition: msi.c:184
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2313
static BOOL delete_pf(const char *rel_path, BOOL is_file)
Definition: msi.c:170
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
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
UINT WINAPI MsiConfigureProductA(LPCSTR szProduct, int iInstallLevel, INSTALLSTATE eInstallState)
Definition: msi.c:957
#define MAX_PATH
Definition: compat.h:26
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
static const char msifile[]
Definition: msi.c:37
static const msi_table ci2_tables[]
Definition: msi.c:1021
static void create_file(LPCSTR name, LPCSTR data, DWORD size)
Definition: msi.c:1431
static char CURR_DIR[MAX_PATH]
Definition: msi.c:39
#define create_database(name, tables, num_tables)
Definition: msi.c:1087
#define ok(value,...)
Definition: atltest.h:57
Definition: services.c:325
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
unsigned int UINT
Definition: ndis.h:50
#define skip(...)
Definition: atltest.h:64
static const msi_table ci_tables[]
Definition: msi.c:1008

Referenced by START_TEST().

◆ test_getcomponentpath()

static void test_getcomponentpath ( void  )
static

Definition at line 1391 of file msi.c.

1392 {
1393  INSTALLSTATE r;
1394  char buffer[0x100];
1395  DWORD sz;
1396 
1397  if(!pMsiGetComponentPathA)
1398  return;
1399 
1400  r = pMsiGetComponentPathA( NULL, NULL, NULL, NULL );
1401  ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n");
1402 
1403  r = pMsiGetComponentPathA( "bogus", "bogus", NULL, NULL );
1404  ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n");
1405 
1406  r = pMsiGetComponentPathA( "bogus", "{00000000-0000-0000-000000000000}", NULL, NULL );
1407  ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n");
1408 
1409  sz = sizeof buffer;
1410  buffer[0]=0;
1411  r = pMsiGetComponentPathA( "bogus", "{00000000-0000-0000-000000000000}", buffer, &sz );
1412  ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n");
1413 
1414  r = pMsiGetComponentPathA( "{00000000-78E1-11D2-B60F-006097C998E7}",
1415  "{00000000-0000-0000-0000-000000000000}", buffer, &sz );
1416  ok( r == INSTALLSTATE_UNKNOWN, "wrong return value\n");
1417 
1418  r = pMsiGetComponentPathA( "{00000409-78E1-11D2-B60F-006097C998E7}",
1419  "{00000000-0000-0000-0000-00000000}", buffer, &sz );
1420  ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n");
1421 
1422  r = pMsiGetComponentPathA( "{00000409-78E1-11D2-B60F-006097C998E7}",
1423  "{029E403D-A86A-1D11-5B5B0006799C897E}", buffer, &sz );
1424  ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n");
1425 
1426  r = pMsiGetComponentPathA( "{00000000-78E1-11D2-B60F-006097C9987e}",
1427  "{00000000-A68A-11d1-5B5B-0006799C897E}", buffer, &sz );
1428  ok( r == INSTALLSTATE_UNKNOWN, "wrong return value\n");
1429 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint buffer
Definition: glext.h:5915
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
int INSTALLSTATE
Definition: msiserver.idl:35
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ test_lastusedsource()

static void test_lastusedsource ( void  )
static

Definition at line 14433 of file msi.c.

14434 {
14435  static const char prodcode[] = "{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}";
14436  char value[MAX_PATH], path[MAX_PATH];
14437  DWORD size;
14438  UINT r;
14439 
14440  if (!pMsiSourceListGetInfoA)
14441  {
14442  win_skip("MsiSourceListGetInfoA is not available\n");
14443  return;
14444  }
14445 
14446  CreateDirectoryA("msitest", NULL);
14447  create_file("maximus", "maximus", 500);
14448  create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
14449  DeleteFileA("maximus");
14450 
14451  create_database("msifile0.msi", lus0_tables, sizeof(lus0_tables) / sizeof(msi_table));
14452  create_database("msifile1.msi", lus1_tables, sizeof(lus1_tables) / sizeof(msi_table));
14453  create_database("msifile2.msi", lus2_tables, sizeof(lus2_tables) / sizeof(msi_table));
14454 
14456 
14457  /* no cabinet file */
14458 
14459  size = MAX_PATH;
14460  lstrcpyA(value, "aaa");
14461  r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
14463  ok(r == ERROR_UNKNOWN_PRODUCT, "expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
14464  ok(!lstrcmpA(value, "aaa"), "expected \"aaa\", got \"%s\"\n", value);
14465 
14466  r = MsiInstallProductA("msifile0.msi", "PUBLISH_PRODUCT=1");
14468  {
14469  skip("Not enough rights to perform tests\n");
14470  goto error;
14471  }
14472  ok(r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r);
14473 
14475  lstrcatA(path, "\\");
14476 
14477  size = MAX_PATH;
14478  lstrcpyA(value, "aaa");
14479  r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
14481  ok(r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r);
14482  ok(!lstrcmpA(value, path), "expected \"%s\", got \"%s\"\n", path, value);
14483  ok(size == lstrlenA(path), "expected %d, got %d\n", lstrlenA(path), size);
14484 
14485  r = MsiInstallProductA("msifile0.msi", "REMOVE=ALL");
14486  ok(r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r);
14487 
14488  /* separate cabinet file */
14489 
14490  size = MAX_PATH;
14491  lstrcpyA(value, "aaa");
14492  r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
14494  ok(r == ERROR_UNKNOWN_PRODUCT, "expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
14495  ok(!lstrcmpA(value, "aaa"), "expected \"aaa\", got \"%s\"\n", value);
14496 
14497  r = MsiInstallProductA("msifile1.msi", "PUBLISH_PRODUCT=1");
14498  ok(r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r);
14499 
14501  lstrcatA(path, "\\");
14502 
14503  size = MAX_PATH;
14504  lstrcpyA(value, "aaa");
14505  r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
14507  ok(r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r);
14508  ok(!lstrcmpA(value, path), "expected \"%s\", got \"%s\"\n", path, value);
14509  ok(size == lstrlenA(path), "expected %d, got %d\n", lstrlenA(path), size);
14510 
14511  r = MsiInstallProductA("msifile1.msi", "REMOVE=ALL");
14512  ok(r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r);
14513 
14514  size = MAX_PATH;
14515  lstrcpyA(value, "aaa");
14516  r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
14518  ok(r == ERROR_UNKNOWN_PRODUCT, "expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
14519  ok(!lstrcmpA(value, "aaa"), "expected \"aaa\", got \"%s\"\n", value);
14520 
14521  /* embedded cabinet stream */
14522 
14523  add_cabinet_storage("msifile2.msi", "test1.cab");
14524 
14525  r = MsiInstallProductA("msifile2.msi", "PUBLISH_PRODUCT=1");
14526  ok(r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r);
14527 
14528  size = MAX_PATH;
14529  lstrcpyA(value, "aaa");
14530  r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
14532  ok(r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r);
14533  ok(!lstrcmpA(value, path), "expected \"%s\", got \"%s\"\n", path, value);
14534  ok(size == lstrlenA(path), "expected %d, got %d\n", lstrlenA(path), size);
14535 
14536  r = MsiInstallProductA("msifile2.msi", "REMOVE=ALL");
14537  ok(r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r);
14538 
14539  size = MAX_PATH;
14540  lstrcpyA(value, "aaa");
14541  r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
14543  ok(r == ERROR_UNKNOWN_PRODUCT, "expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
14544  ok(!lstrcmpA(value, "aaa"), "expected \"aaa\", got \"%s\"\n", value);
14545 
14546 error:
14547  delete_cab_files();
14548  DeleteFileA("msitest\\maximus");
14549  RemoveDirectoryA("msitest");
14550  DeleteFileA("msifile0.msi");
14551  DeleteFileA("msifile1.msi");
14552  DeleteFileA("msifile2.msi");
14553 }
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define INSTALLPROPERTY_LASTUSEDSOURCEA
Definition: msi.h:404
#define ERROR_SUCCESS
Definition: deptool.c:10
#define error(str)
Definition: mkdosfs.c:1605
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:205
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static void delete_cab_files(void)
Definition: msi.c:472
#define MEDIA_SIZE
Definition: msi.c:225
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2313
static BOOL add_cabinet_storage(LPCSTR db, LPCSTR cabinet)
Definition: msi.c:435
static const msi_table lus2_tables[]
Definition: msi.c:968
static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
Definition: msi.c:404
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
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
GLsizeiptr size
Definition: glext.h:5919
static const msi_table lus1_tables[]
Definition: msi.c:956
#define ERROR_UNKNOWN_PRODUCT
Definition: winerror.h:963
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
static const msi_table lus0_tables[]
Definition: msi.c:944
static void create_file(LPCSTR name, LPCSTR data, DWORD size)
Definition: msi.c:1431
static char CURR_DIR[MAX_PATH]
Definition: msi.c:39
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define create_database(name, tables, num_tables)
Definition: msi.c:1087
#define ok(value,...)
Definition: atltest.h:57
Definition: services.c:325
DWORD size
Definition: msi.c:1488
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
unsigned int UINT
Definition: ndis.h:50
#define skip(...)
Definition: atltest.h:64
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test_MsiConfigureProductEx()

static void test_MsiConfigureProductEx ( void  )
static

Definition at line 13888 of file msi.c.

13889 {
13890  UINT r;
13891  LONG res;
13892  DWORD type, size;
13893  HKEY props, source;
13894  CHAR keypath[MAX_PATH * 2], localpackage[MAX_PATH], packagename[MAX_PATH];
13896 
13897  if (is_process_limited())
13898  {
13899  skip("process is limited\n");
13900  return;
13901  }
13902 
13903  CreateDirectoryA("msitest", NULL);
13904  create_file("msitest\\hydrogen", "hydrogen", 500);
13905  create_file("msitest\\helium", "helium", 500);
13906  create_file("msitest\\lithium", "lithium", 500);
13907 
13908  create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
13909 
13910  if (is_wow64)
13912 
13914 
13915  /* NULL szProduct */
13917  INSTALLSTATE_DEFAULT, "PROPVAR=42");
13919  "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
13920 
13921  /* empty szProduct */
13923  INSTALLSTATE_DEFAULT, "PROPVAR=42");
13925  "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
13926 
13927  /* garbage szProduct */
13929  INSTALLSTATE_DEFAULT, "PROPVAR=42");
13931  "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
13932 
13933  /* guid without brackets */
13934  r = MsiConfigureProductExA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D",
13936  "PROPVAR=42");
13938  "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
13939 
13940  /* guid with brackets */
13941  r = MsiConfigureProductExA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}",
13943  "PROPVAR=42");
13945  "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
13946 
13947  /* same length as guid, but random */
13948  r = MsiConfigureProductExA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93",
13950  "PROPVAR=42");
13952  "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
13953 
13954  /* product not installed yet */
13955  r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
13957  "PROPVAR=42");
13959  "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
13960 
13961  /* install the product, per-user unmanaged */
13962  r = MsiInstallProductA(msifile, "INSTALLLEVEL=10 PROPVAR=42");
13964  {
13965  skip("Not enough rights to perform tests\n");
13966  goto error;
13967  }
13968  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
13969  ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
13970  ok(pf_exists("msitest\\helium"), "File not installed\n");
13971  ok(pf_exists("msitest\\lithium"), "File not installed\n");
13972  ok(pf_exists("msitest"), "File not installed\n");
13973 
13974  /* product is installed per-user managed, remove it */
13975  r = MsiConfigureProductExA("{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}",
13977  "PROPVAR=42");
13978  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
13979  ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
13980  ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
13981  ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
13982  ok(!delete_pf("msitest", FALSE), "Directory not removed\n");
13983 
13984  /* product has been removed */
13985  r = MsiConfigureProductExA("{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}",
13987  "PROPVAR=42");
13989  "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
13990 
13991  /* install the product, machine */
13992  r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
13993  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
13994  ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
13995  ok(pf_exists("msitest\\helium"), "File not installed\n");
13996  ok(pf_exists("msitest\\lithium"), "File not installed\n");
13997  ok(pf_exists("msitest"), "File not installed\n");
13998 
13999  /* product is installed machine, remove it */
14000  r = MsiConfigureProductExA("{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}",
14002  "PROPVAR=42");
14003  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
14004  ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
14005  ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
14006  ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
14007  ok(!delete_pf("msitest", FALSE), "Directory not removed\n");
14008 
14009  /* product has been removed */
14010  r = MsiConfigureProductExA("{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}",
14012  "PROPVAR=42");
14014  "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
14015 
14016  /* install the product, machine */
14017  r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
14018  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
14019  ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
14020  ok(pf_exists("msitest\\helium"), "File not installed\n");
14021  ok(pf_exists("msitest\\lithium"), "File not installed\n");
14022  ok(pf_exists("msitest"), "File not installed\n");
14023 
14025 
14026  /* msifile is removed */
14027  r = MsiConfigureProductExA("{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}",
14029  "PROPVAR=42");
14030  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
14031  ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
14032  ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
14033  ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
14034  ok(!delete_pf("msitest", FALSE), "Directory not removed\n");
14035 
14036  create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
14037 
14038  /* install the product, machine */
14039  r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
14040  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
14041  ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
14042  ok(pf_exists("msitest\\helium"), "File not installed\n");
14043  ok(pf_exists("msitest\\lithium"), "File not installed\n");
14044  ok(pf_exists("msitest"), "File not installed\n");
14045 
14047 
14048  lstrcpyA(keypath, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\");
14049  lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
14050  lstrcatA(keypath, "83374883CBB1401418CAF2AA7CCEDDDC\\InstallProperties");
14051 
14052  res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &props);
14053  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
14054 
14055  type = REG_SZ;
14056  size = MAX_PATH;
14057  res = RegQueryValueExA(props, "LocalPackage", NULL, &type,
14058  (LPBYTE)localpackage, &size);
14059  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
14060 
14061  res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
14062  (const BYTE *)"C:\\idontexist.msi", 18);
14063  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
14064 
14065  /* LocalPackage is used to find the cached msi package */
14066  r = MsiConfigureProductExA("{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}",
14068  "PROPVAR=42");
14070  "Expected ERROR_INSTALL_SOURCE_ABSENT, got %d\n", r);
14071  ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
14072  ok(pf_exists("msitest\\helium"), "File not installed\n");
14073  ok(pf_exists("msitest\\lithium"), "File not installed\n");
14074  ok(pf_exists("msitest"), "File not installed\n");
14075 
14076  RegCloseKey(props);
14077  create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
14078 
14079  /* LastUsedSource can be used as a last resort */
14080  r = MsiConfigureProductExA("{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}",
14082  "PROPVAR=42");
14083  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
14084  ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
14085  ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
14086  ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
14087  ok(!delete_pf("msitest", FALSE), "Directory not removed\n");
14088  DeleteFileA( localpackage );
14089 
14090  /* install the product, machine */
14091  r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
14092  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
14093  ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
14094  ok(pf_exists("msitest\\helium"), "File not installed\n");
14095  ok(pf_exists("msitest\\lithium"), "File not installed\n");
14096  ok(pf_exists("msitest"), "File not installed\n");
14097 
14098  lstrcpyA(keypath, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\");
14099  lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
14100  lstrcatA(keypath, "83374883CBB1401418CAF2AA7CCEDDDC\\InstallProperties");
14101 
14102  res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &props);
14103  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
14104 
14105  type = REG_SZ;
14106  size = MAX_PATH;
14107  res = RegQueryValueExA(props, "LocalPackage", NULL, &type,
14108  (LPBYTE)localpackage, &size);
14109  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
14110 
14111  res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
14112  (const BYTE *)"C:\\idontexist.msi", 18);
14113  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
14114 
14115  lstrcpyA(keypath, "SOFTWARE\\Classes\\Installer\\Products\\");
14116  lstrcatA(keypath, "83374883CBB1401418CAF2AA7CCEDDDC\\SourceList");
14117 
14118  res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &source);
14119  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
14120 
14121  type = REG_SZ;
14122  size = MAX_PATH;
14123  res = RegQueryValueExA(source, "PackageName", NULL, &type,
14124  (LPBYTE)packagename, &size);
14125  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
14126 
14127  res = RegSetValueExA(source, "PackageName", 0, REG_SZ,
14128  (const BYTE *)"idontexist.msi", 15);
14129  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
14130 
14131  /* SourceList is altered */
14132  r = MsiConfigureProductExA("{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}",
14134  "PROPVAR=42");
14136  "Expected ERROR_INSTALL_SOURCE_ABSENT, got %d\n", r);
14137  ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
14138  ok(pf_exists("msitest\\helium"), "File not installed\n");
14139  ok(pf_exists("msitest\\lithium"), "File not installed\n");
14140  ok(pf_exists("msitest"), "File not installed\n");
14141 
14142  /* restore PackageName */
14143  res = RegSetValueExA(source, "PackageName", 0, REG_SZ,
14144  (const BYTE *)packagename, lstrlenA(packagename) + 1);
14145  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
14146 
14147  /* restore LocalPackage */
14148  res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
14149  (const BYTE *)localpackage, lstrlenA(localpackage) + 1);
14150  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
14151 
14152  /* finally remove the product */
14153  r = MsiConfigureProductExA("{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}",
14155  "PROPVAR=42");
14156  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
14157  ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
14158  ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
14159  ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
14160  ok(!delete_pf("msitest", FALSE), "Directory not removed\n");
14161 
14163  RegCloseKey(props);
14164 
14165 error:
14166  DeleteFileA("msitest\\hydrogen");
14167  DeleteFileA("msitest\\helium");
14168  DeleteFileA("msitest\\lithium");
14169  RemoveDirectoryA("msitest");
14171 }
static const msi_table mcp_tables[]
Definition: msi.c:932
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4023
#define ERROR_INSTALL_PACKAGE_REJECTED
Definition: winerror.h:983
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define error(str)
Definition: mkdosfs.c:1605
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:205
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
char CHAR
Definition: xmlstorage.h:175
static BOOL is_process_limited(void)
Definition: msi.c:184
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3331
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2313
static BOOL delete_pf(const char *rel_path, BOOL is_file)
Definition: msi.c:170
static BOOL pf_exists(const char *file)
Definition: msi.c:160
static BOOL is_wow64
Definition: msi.c:36
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
long LONG
Definition: pedump.c:60
UINT WINAPI MsiConfigureProductExA(LPCSTR szProduct, int iInstallLevel, INSTALLSTATE eInstallState, LPCSTR szCommandLine)
Definition: msi.c:927
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 KEY_WOW64_64KEY
Definition: cmtypes.h:46
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
GLsizeiptr size
Definition: glext.h:5919
#define ERROR_UNKNOWN_PRODUCT
Definition: winerror.h:963
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
static const char msifile[]
Definition: msi.c:37
unsigned char BYTE
Definition: mem.h:68
static void create_file(LPCSTR name, LPCSTR data, DWORD size)
Definition: msi.c:1431
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define create_database(name, tables, num_tables)
Definition: msi.c:1087
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
GLsizei GLsizei GLchar * source
Definition: glext.h:6048
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define ok(value,...)
Definition: atltest.h:57
DWORD size
Definition: msi.c:1488
ACCESS_MASK REGSAM
Definition: winreg.h:69
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
unsigned int UINT
Definition: ndis.h:50
#define skip(...)
Definition: atltest.h:64
#define ERROR_INSTALL_SOURCE_ABSENT
Definition: winerror.h:970
static const WCHAR props[]
Definition: wbemdisp.c:288
GLuint res
Definition: glext.h:9613
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4812
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22

Referenced by START_TEST().

◆ test_MsiEnumClients()

static void test_MsiEnumClients ( void  )
static

Definition at line 4254 of file msi.c.

4255 {
4256  HKEY compkey;
4257  CHAR prodcode[MAX_PATH];
4258  CHAR prod_squashed[MAX_PATH];
4259  CHAR prodcode2[MAX_PATH];
4260  CHAR prod2_squashed[MAX_PATH];
4261  CHAR component[MAX_PATH];
4262  CHAR comp_base85[MAX_PATH];
4263  CHAR comp_squashed[MAX_PATH];
4264  CHAR product[MAX_PATH];
4265  CHAR keypath[MAX_PATH];
4266  LPSTR usersid;
4267  LONG res;
4268  UINT r;
4270 
4271  create_test_guid(prodcode, prod_squashed);
4272  create_test_guid(prodcode2, prod2_squashed);
4273  compose_base85_guid(component, comp_base85, comp_squashed);
4274  usersid = get_user_sid();
4275 
4276  if (is_wow64)
4278 
4279  /* NULL szComponent */
4280  product[0] = '\0';
4281  r = MsiEnumClientsA(NULL, 0, product);
4282  ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
4283  ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
4284 
4285  /* empty szComponent */
4286  product[0] = '\0';
4287  r = MsiEnumClientsA("", 0, product);
4288  ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
4289  ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
4290 
4291  /* NULL lpProductBuf */
4292  r = MsiEnumClientsA(component, 0, NULL);
4293  ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
4294 
4295  /* all params correct, component missing */
4296  product[0] = '\0';
4297  r = MsiEnumClientsA(component, 0, product);
4298  ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
4299  ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
4300 
4301  lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
4302  lstrcatA(keypath, "Installer\\UserData\\");
4303  lstrcatA(keypath, usersid);
4304  lstrcatA(keypath, "\\Components\\");
4305  lstrcatA(keypath, comp_squashed);
4306 
4307  res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &compkey, NULL);
4308  if (res == ERROR_ACCESS_DENIED)
4309  {
4310  skip("Not enough rights to perform tests\n");
4311  LocalFree(usersid);
4312  return;
4313  }
4314  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4315 
4316  /* user unmanaged component key exists */
4317  product[0] = '\0';
4318  r = MsiEnumClientsA(component, 0, product);
4319  ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
4320  ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
4321 
4322  /* index > 0, no products exist */
4323  product[0] = '\0';
4324  r = MsiEnumClientsA(component, 1, product);
4325  ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
4326  ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
4327 
4328  res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"C:\\imapath", 10);
4329  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4330 
4331  /* product value exists */
4332  r = MsiEnumClientsA(component, 0, product);
4333  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4334  ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
4335 
4336  /* try index 0 again */
4337  product[0] = '\0';
4338  r = MsiEnumClientsA(component, 0, product);
4339  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4340  ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
4341 
4342  /* try index 1, second product value does not exist */
4343  product[0] = '\0';
4344  r = MsiEnumClientsA(component, 1, product);
4345  ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
4346  ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
4347 
4348  res = RegSetValueExA(compkey, prod2_squashed, 0, REG_SZ, (const BYTE *)"C:\\another", 10);
4349  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4350 
4351  /* try index 1, second product value does exist */
4352  product[0] = '\0';
4353  r = MsiEnumClientsA(component, 1, product);
4354  todo_wine
4355  {
4356  ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
4357  ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
4358  }
4359 
4360  /* start the enumeration over */
4361  product[0] = '\0';
4362  r = MsiEnumClientsA(component, 0, product);
4363  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4364  ok(!lstrcmpA(product, prodcode) || !lstrcmpA(product, prodcode2),
4365  "Expected %s or %s, got %s\n", prodcode, prodcode2, product);
4366 
4367  /* correctly query second product */
4368  product[0] = '\0';
4369  r = MsiEnumClientsA(component, 1, product);
4370  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4371  ok(!lstrcmpA(product, prodcode) || !lstrcmpA(product, prodcode2),
4372  "Expected %s or %s, got %s\n", prodcode, prodcode2, product);
4373 
4374  RegDeleteValueA(compkey, prod_squashed);
4375  RegDeleteValueA(compkey, prod2_squashed);
4376  delete_key(compkey, "", access & KEY_WOW64_64KEY);
4377  RegCloseKey(compkey);
4378 
4379  lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
4380  lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Components\\");
4381  lstrcatA(keypath, comp_squashed);
4382 
4383  res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &compkey, NULL);
4384  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4385 
4386  /* user local component key exists */
4387  product[0] = '\0';
4388  r = MsiEnumClientsA(component, 0, product);
4389  ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
4390  ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
4391 
4392  /* index > 0, no products exist */
4393  product[0] = '\0';
4394  r = MsiEnumClientsA(component, 1, product);
4395  ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
4396  ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
4397 
4398  res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"C:\\imapath", 10);
4399  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4400 
4401  /* product value exists */
4402  product[0] = '\0';
4403  r = MsiEnumClientsA(component, 0, product);
4404  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4405  ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
4406 
4407  /* try index 0 again */
4408  product[0] = '\0';
4409  r = MsiEnumClientsA(component, 0, product);
4410  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4411 
4412  /* try index 1, second product value does not exist */
4413  product[0] = '\0';
4414  r = MsiEnumClientsA(component, 1, product);
4415  ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
4416  ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
4417 
4418  res = RegSetValueExA(compkey, prod2_squashed, 0, REG_SZ, (const BYTE *)"C:\\another", 10);
4419  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4420 
4421  /* try index 1, second product value does exist */
4422  product[0] = '\0';
4423  r = MsiEnumClientsA(component, 1, product);
4424  todo_wine
4425  {
4426  ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
4427  ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
4428  }
4429 
4430  /* start the enumeration over */
4431  product[0] = '\0';
4432  r = MsiEnumClientsA(component, 0, product);
4433  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4434  ok(!lstrcmpA(product, prodcode) || !lstrcmpA(product, prodcode2),
4435  "Expected %s or %s, got %s\n", prodcode, prodcode2, product);
4436 
4437  /* correctly query second product */
4438  product[0] = '\0';
4439  r = MsiEnumClientsA(component, 1, product);
4440  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4441  ok(!lstrcmpA(product, prodcode) || !lstrcmpA(product, prodcode2),
4442  "Expected %s or %s, got %s\n", prodcode, prodcode2, product);
4443 
4444  RegDeleteValueA(compkey, prod_squashed);
4445  RegDeleteValueA(compkey, prod2_squashed);
4446  delete_key(compkey, "", access & KEY_WOW64_64KEY);
4447  RegCloseKey(compkey);
4448  LocalFree(usersid);
4449 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
UINT WINAPI MsiEnumClientsA(LPCSTR szComponent, DWORD index, LPSTR szProduct)
Definition: registry.c:1468
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
char CHAR
Definition: xmlstorage.h:175
static LONG delete_key(HKEY key, LPCSTR subkey, REGSAM access)
Definition: msi.c:1276
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
char * LPSTR
Definition: xmlstorage.h:182
static void compose_base85_guid(LPSTR component, LPSTR comp_base85, LPSTR squashed)
Definition: msi.c:1977
static BOOL is_wow64
Definition: msi.c:36
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define ERROR_ACCESS_DENIED
Definition: compat.h:87
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
#define MAX_PATH
Definition: compat.h:26
static char * get_user_sid(void)
Definition: msi.c:1632
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
#define todo_wine
Definition: test.h:154
unsigned char BYTE
Definition: mem.h:68
static void create_test_guid(LPSTR prodcode, LPSTR squashed)
Definition: msi.c:1610
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define ok(value,...)
Definition: atltest.h:57
LONG WINAPI RegDeleteValueA(HKEY hKey, LPCSTR lpValueName)
Definition: reg.c:2319
ACCESS_MASK REGSAM
Definition: winreg.h:69
#define ERROR_UNKNOWN_COMPONENT
Definition: winerror.h:965
unsigned int UINT
Definition: ndis.h:50
#define skip(...)
Definition: atltest.h:64
GLuint res
Definition: glext.h:9613
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4812
LONG WINAPI RegCreateKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD Reserved, _In_ LPSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_ LPDWORD lpdwDisposition)
Definition: reg.c:1029
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22

Referenced by START_TEST().

◆ test_MsiEnumComponents()

static void test_MsiEnumComponents ( void  )
static

Definition at line 13725 of file msi.c.

13726 {
13727  UINT r;
13728  BOOL found1, found2;
13729  DWORD index;
13730  char comp1[39], comp2[39], guid[39];
13731  char comp_squashed1[33], comp_squashed2[33];
13732  char keypath1[MAX_PATH], keypath2[MAX_PATH];
13734  char *usersid = get_user_sid();
13735  HKEY key1 = NULL, key2 = NULL;
13736 
13737  create_test_guid( comp1, comp_squashed1 );
13738  create_test_guid( comp2, comp_squashed2 );
13739 
13741 
13742  strcpy( keypath1, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\" );
13743  strcat( keypath1, "S-1-5-18\\Components\\" );
13744  strcat( keypath1, comp_squashed1 );
13745 
13746  r = RegCreateKeyExA( HKEY_LOCAL_MACHINE, keypath1, 0, NULL, 0, access, NULL, &key1, NULL );
13747  if (r == ERROR_ACCESS_DENIED)
13748  {
13749  skip( "insufficient rights\n" );
13750  goto done;
13751  }
13752  ok( r == ERROR_SUCCESS, "got %u\n", r );
13753 
13754  strcpy( keypath2, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\" );
13755  strcat( keypath2, usersid );
13756  strcat( keypath2, "\\Components\\" );
13757  strcat( keypath2, comp_squashed2 );
13758 
13759  r = RegCreateKeyExA( HKEY_LOCAL_MACHINE, keypath2, 0, NULL, 0, access, NULL, &key2, NULL );
13760  if (r == ERROR_ACCESS_DENIED)
13761  {
13762  skip( "insufficient rights\n" );
13763  goto done;
13764  }
13765 
13766  r = MsiEnumComponentsA( 0, NULL );
13767  ok( r == ERROR_INVALID_PARAMETER, "got %u\n", r );
13768 
13769  index = 0;
13770  guid[0] = 0;
13771  found1 = found2 = FALSE;
13772  while (!MsiEnumComponentsA( index, guid ))
13773  {
13774  if (!strcmp( guid, comp1 )) found1 = TRUE;
13775  if (!strcmp( guid, comp2 )) found2 = TRUE;
13776  ok( guid[0], "empty guid\n" );
13777  guid[0] = 0;
13778  index++;
13779  }
13780  ok( found1, "comp1 not found\n" );
13781  ok( found2, "comp2 not found\n" );
13782 
13783 done:
13784  delete_key( key1, "", access );
13785  delete_key( key2, "", access );
13786  RegCloseKey( key1 );
13787  RegCloseKey( key2 );
13788  LocalFree( usersid );
13789 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
GLuint64EXT GLuint GLuint GLenum GLenum GLuint GLuint GLenum GLuint GLuint key1
Definition: glext.h:10608
#define ERROR_SUCCESS
Definition: deptool.c:10
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static LONG delete_key(HKEY key, LPCSTR subkey, REGSAM access)
Definition: msi.c:1276
UINT WINAPI MsiEnumComponentsA(DWORD index, LPSTR lpguid)
Definition: registry.c:1231
static BOOL is_wow64
Definition: msi.c:36
const GUID * guid
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define ERROR_ACCESS_DENIED
Definition: compat.h:87
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
#define MAX_PATH</