ReactOS  0.4.14-dev-554-g2f8d847
patch.c File Reference
#include <stdio.h>
#include <windows.h>
#include <msiquery.h>
#include <msidefs.h>
#include <msi.h>
#include <wtypes.h>
#include "wine/test.h"
Include dependency graph for patch.c:

Go to the source code of this file.

Classes

struct  msi_table
 
struct  table_data
 

Macros

#define _WIN32_MSI   300
 
#define COBJMACROS
 
#define ADD_TABLE(x)   { #x".idt", x##_dat, sizeof(x##_dat) }
 
#define GET_PROC(mod, func)
 
#define create_file(name, size)   create_file_data( name, name, size )
 
#define NUM_PATCH_TABLES   (sizeof table_patch_data/sizeof table_patch_data[0])
 
#define NUM_TRANSFORM1_TABLES   (sizeof table_transform1_data/sizeof table_transform1_data[0])
 
#define NUM_TRANSFORM2_TABLES   (sizeof table_transform2_data/sizeof table_transform2_data[0])
 

Functions

static UINT (WINAPI *pMsiApplyPatchA)(LPCSTR
 
static BOOL (WINAPI *pOpenProcessToken)(HANDLE
 
static void init_function_pointers (void)
 
static BOOL is_process_limited (void)
 
static BOOL get_program_files_dir (char *buf, char *buf2)
 
static void create_file_data (const char *filename, const char *data, DWORD size)
 
static BOOL delete_pf (const char *rel_path, BOOL is_file)
 
static DWORD get_pf_file_size (const char *filename)
 
static void write_file (const char *filename, const char *data, DWORD data_size)
 
static void set_suminfo (const WCHAR *filename)
 
static void create_database (const char *filename, const struct msi_table *tables, UINT num_tables)
 
static void write_tables (IStorage *stg, const struct table_data *tables, UINT num_tables)
 
static void create_patch (const char *filename)
 
static void test_simple_patch (void)
 
static void test_MsiOpenDatabase (void)
 
static UINT find_entry (MSIHANDLE hdb, const char *table, const char *entry)
 
static UINT find_entryW (MSIHANDLE hdb, const WCHAR *table, const WCHAR *entry)
 
static INT get_integer (MSIHANDLE hdb, UINT field, const char *query)
 
static charget_string (MSIHANDLE hdb, UINT field, const char *query)
 
static void test_system_tables (void)
 
static void test_patch_registration (void)
 
 START_TEST (patch)
 

Variables

static LPCSTR
 
static INSTALLTYPE
 
static MSIINSTALLCONTEXT
 
static LPSTR
 
static DWORD *static DWORD
 
static DWORD *static MSIINSTALLCONTEXT LPDWORD
 
static PHANDLE
 
static const charmsifile = "winetest-patch.msi"
 
static const charmspfile = "winetest-patch.msp"
 
static const WCHAR msifileW []
 
static const WCHAR mspfileW []
 
static char CURR_DIR [MAX_PATH]
 
static char PROG_FILES_DIR [MAX_PATH]
 
static char COMMON_FILES_DIR [MAX_PATH]
 
static const char property_dat []
 
static const char media_dat []
 
static const char file_dat []
 
static const char directory_dat []
 
static const char component_dat []
 
static const char feature_dat []
 
static const char feature_comp_dat []
 
static const char install_exec_seq_dat []
 
static const struct msi_table tables []
 
static const WCHAR p_name0 [] = { 0x4840, 0x3b3f, 0x43f2, 0x4438, 0x45b1, 0 }
 
static const WCHAR p_name1 [] = { 0x4840, 0x3f7f, 0x4164, 0x422f, 0x4836, 0 }
 
static const WCHAR p_name2 [] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0 }
 
static const WCHAR p_name3 [] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0x482f, 0 }
 
static const WCHAR p_name4 [] = { 0x3a8c, 0x47cb, 0x45b0, 0x45ec, 0x45a8, 0x4837, 0}
 
static const WCHAR p_name5 [] = { 0x4840, 0x4596, 0x3e6c, 0x45e4, 0x42e6, 0x421c, 0x4634, 0x4468, 0x4226, 0 }
 
static const WCHAR p_name6 []
 
static const WCHAR p_name7 []
 
static const WCHAR p_name8 []
 
static const WCHAR p_data0 []
 
static const WCHAR p_data1 []
 
static const char p_data2 []
 
static const WCHAR p_data3 []
 
static const char p_data4 []
 
static const WCHAR p_data5 []
 
static const char p_data6 []
 
static const struct table_data table_patch_data []
 
static const WCHAR t1_name0 [] = { 0x4840, 0x430f, 0x422f, 0 }
 
static const WCHAR t1_name1 [] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0 }
 
static const WCHAR t1_name2 [] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0x482f, 0 }
 
static const WCHAR t1_name3 []
 
static const WCHAR t1_data0 []
 
static const char t1_data1 []
 
static const WCHAR t1_data2 []
 
static const char t1_data3 []
 
static const struct table_data table_transform1_data []
 
static const WCHAR t2_name0 [] = { 0x4840, 0x430f, 0x422f, 0 }
 
static const WCHAR t2_name1 [] = { 0x4840, 0x4216, 0x4327, 0x4824, 0 }
 
static const WCHAR t2_name2 [] = { 0x4840, 0x3b3f, 0x43f2, 0x4438, 0x45b1, 0 }
 
static const WCHAR t2_name3 [] = { 0x4840, 0x3f7f, 0x4164, 0x422f, 0x4836, 0 }
 
static const WCHAR t2_name4 [] = { 0x4840, 0x4559, 0x44f2, 0x4568, 0x4737, 0 }
 
static const WCHAR t2_name5 [] = { 0x4840, 0x4119, 0x41b7, 0x3e6b, 0x41a4, 0x412e, 0x422a, 0 }
 
static const WCHAR t2_name6 []
 
static const WCHAR t2_name7 [] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0 }
 
static const WCHAR t2_name8 [] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0x482f, 0 }
 
static const WCHAR t2_name9 []
 
static const WCHAR t2_data0 []
 
static const WCHAR t2_data1 []
 
static const WCHAR t2_data2 []
 
static const WCHAR t2_data3 []
 
static const WCHAR t2_data4 []
 
static const WCHAR t2_data5 []
 
static const WCHAR t2_data6 []
 
static const char t2_data7 []
 
static const WCHAR t2_data8 []
 
static const char t2_data9 []
 
static const struct table_data table_transform2_data []
 

Macro Definition Documentation

◆ _WIN32_MSI

#define _WIN32_MSI   300

Definition at line 21 of file patch.c.

◆ ADD_TABLE

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

Definition at line 131 of file patch.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 22 of file patch.c.

◆ create_file

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

Definition at line 225 of file patch.c.

◆ GET_PROC

#define GET_PROC (   mod,
  func 
)
Value:
p ## func = (void *)GetProcAddress( mod, #func ); \
if (!p ## func) \
trace( "GetProcAddress(%s) failed\n", #func );
GLenum func
Definition: glext.h:6028
#define GetProcAddress(x, y)
Definition: compat.h:418
GLfloat GLfloat p
Definition: glext.h:8902
static int mod
Definition: i386-dis.c:1273

◆ NUM_PATCH_TABLES

#define NUM_PATCH_TABLES   (sizeof table_patch_data/sizeof table_patch_data[0])

Definition at line 449 of file patch.c.

◆ NUM_TRANSFORM1_TABLES

Definition at line 522 of file patch.c.

◆ NUM_TRANSFORM2_TABLES

Definition at line 647 of file patch.c.

Function Documentation

◆ BOOL()

static BOOL ( WINAPI pOpenProcessToken)
static

◆ create_database()

static void create_database ( const char filename,
const struct msi_table tables,
UINT  num_tables 
)
static

Definition at line 311 of file patch.c.

312 {
313  MSIHANDLE hdb;
314  UINT r, i;
315  WCHAR *filenameW;
316  int len;
317 
318  len = MultiByteToWideChar( CP_ACP, 0, filename, -1, NULL, 0 );
319  if (!(filenameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return;
321 
323  ok(r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r);
324 
325  /* import the tables into the database */
326  for (i = 0; i < num_tables; i++)
327  {
328  const struct msi_table *table = &tables[i];
329 
330  write_file( table->filename, table->data, (table->size - 1) * sizeof(char) );
331 
332  r = MsiDatabaseImportA( hdb, CURR_DIR, table->filename );
333  ok(r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r);
334 
335  DeleteFileA( table->filename );
336  }
337 
338  r = MsiDatabaseCommit( hdb );
339  ok(r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r);
340 
341  MsiCloseHandle( hdb );
344 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define CP_ACP
Definition: compat.h:99
static char CURR_DIR[MAX_PATH]
Definition: patch.c:48
static void write_file(const char *filename, const char *data, DWORD data_size)
Definition: patch.c:260
const char * filename
Definition: ioapi.h:135
unsigned long MSIHANDLE
Definition: msiserver.idl:25
static const WCHAR filenameW[]
Definition: amstream.c:41
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
static const struct msi_table tables[]
Definition: patch.c:133
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MSIDBOPEN_CREATE
Definition: msiquery.h:69
static void set_suminfo(const WCHAR *filename)
Definition: patch.c:269
GLenum GLsizei len
Definition: glext.h:6722
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
BYTE * data
UINT WINAPI MsiDatabaseCommit(MSIHANDLE hdb)
Definition: msiquery.c:813
#define ok(value,...)
Definition: atltest.h:57
UINT WINAPI MsiOpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIHANDLE *phDB)
Definition: database.c:303
unsigned int UINT
Definition: ndis.h:50
#define MultiByteToWideChar
Definition: compat.h:100
#define HeapFree(x, y, z)
Definition: compat.h:402
UINT WINAPI MsiDatabaseImportA(MSIHANDLE handle, LPCSTR szFolder, LPCSTR szFilename)
Definition: database.c:900

Referenced by test_MsiOpenDatabase(), test_patch_registration(), test_simple_patch(), and test_system_tables().

◆ create_file_data()

static void create_file_data ( const char filename,
const char data,
DWORD  size 
)
static

Definition at line 207 of file patch.c.

208 {
209  HANDLE file;
210  DWORD written;
211 
213  if (file == INVALID_HANDLE_VALUE)
214  return;
215 
216  WriteFile( file, data, strlen( data ), &written, NULL );
217  if (size)
218  {
220  SetEndOfFile( file );
221  }
222  CloseHandle( file );
223 }
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:406
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:399
const char * filename
Definition: ioapi.h:135
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 CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:407
Definition: fci.c:126

◆ create_patch()

static void create_patch ( const char filename)
static

Definition at line 671 of file patch.c.

672 {
673  IStorage *stg = NULL, *stg1 = NULL, *stg2 = NULL;
674  WCHAR *filenameW;
675  HRESULT r;
676  int len;
678 
679  const CLSID CLSID_MsiPatch = {0xc1086, 0, 0, {0xc0, 0, 0, 0, 0, 0, 0, 0x46}};
680  const CLSID CLSID_MsiTransform = {0xc1082, 0, 0, {0xc0, 0, 0, 0, 0, 0, 0, 0x46}};
681 
682  len = MultiByteToWideChar( CP_ACP, 0, filename, -1, NULL, 0 );
683  filenameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
685 
686  r = StgCreateDocfile( filenameW, mode, 0, &stg );
688  ok( r == S_OK, "failed to create storage 0x%08x\n", r );
689  if (!stg)
690  return;
691 
692  r = IStorage_SetClass( stg, &CLSID_MsiPatch );
693  ok( r == S_OK, "failed to set storage type 0x%08x\n", r );
694 
696 
697  r = IStorage_CreateStorage( stg, p_name7, mode, 0, 0, &stg1 );
698  ok( r == S_OK, "failed to create substorage 0x%08x\n", r );
699 
700  r = IStorage_SetClass( stg1, &CLSID_MsiTransform );
701  ok( r == S_OK, "failed to set storage type 0x%08x\n", r );
702 
704  IStorage_Release( stg1 );
705 
706  r = IStorage_CreateStorage( stg, p_name8, mode, 0, 0, &stg2 );
707  ok( r == S_OK, "failed to create substorage 0x%08x\n", r );
708 
709  r = IStorage_SetClass( stg2, &CLSID_MsiTransform );
710  ok( r == S_OK, "failed to set storage type 0x%08x\n", r );
711 
713  IStorage_Release( stg2 );
714  IStorage_Release( stg );
715 }
static const struct table_data table_transform2_data[]
Definition: patch.c:634
static const WCHAR p_name8[]
Definition: patch.c:361
#define NUM_TRANSFORM1_TABLES
Definition: patch.c:522
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:922
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define CP_ACP
Definition: compat.h:99
#define STGM_CREATE
Definition: objbase.h:925
const char * filename
Definition: ioapi.h:135
static const WCHAR filenameW[]
Definition: amstream.c:41
static const struct table_data table_patch_data[]
Definition: patch.c:439
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR p_name7[]
Definition: patch.c:359
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define STGM_DIRECT
Definition: objbase.h:913
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
HRESULT WINAPI StgCreateDocfile(LPCOLESTR pwcsName, DWORD grfMode, DWORD reserved, IStorage **ppstgOpen)
Definition: storage32.c:8636
GLenum mode
Definition: glext.h:6217
#define STGM_READWRITE
Definition: objbase.h:918
#define S_OK
Definition: intsafe.h:59
static const struct table_data table_transform1_data[]
Definition: patch.c:515
#define NUM_PATCH_TABLES
Definition: patch.c:449
#define ok(value,...)
Definition: atltest.h:57
#define MultiByteToWideChar
Definition: compat.h:100
#define HeapFree(x, y, z)
Definition: compat.h:402
#define NUM_TRANSFORM2_TABLES
Definition: patch.c:647
static void write_tables(IStorage *stg, const struct table_data *tables, UINT num_tables)
Definition: patch.c:649

Referenced by test_MsiOpenDatabase(), test_patch_registration(), test_simple_patch(), and test_system_tables().

◆ delete_pf()

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

Definition at line 227 of file patch.c.

228 {
229  char path[MAX_PATH];
230 
232  strcat( path, "\\" );
233  strcat( path, rel_path );
234 
235  if (is_file)
236  return DeleteFileA( path );
237  else
238  return RemoveDirectoryA( path );
239 }
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define MAX_PATH
Definition: compat.h:26
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
static char PROG_FILES_DIR[MAX_PATH]
Definition: patch.c:49
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388

Referenced by test_simple_patch().

◆ find_entry()

static UINT find_entry ( MSIHANDLE  hdb,
const char table,
const char entry 
)
static

Definition at line 952 of file patch.c.

953 {
954  static const char fmt[] = "SELECT * FROM `%s` WHERE `Name` = '%s'";
955  char query[0x100];
956  UINT r;
957  MSIHANDLE hview, hrec;
958 
959  sprintf( query, fmt, table, entry );
960  r = MsiDatabaseOpenViewA( hdb, query, &hview );
961  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
962 
963  r = MsiViewExecute( hview, 0 );
964  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
965 
966  r = MsiViewFetch( hview, &hrec );
967  MsiViewClose( hview );
968  MsiCloseHandle( hview );
969  MsiCloseHandle( hrec );
970  return r;
971 }
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
#define sprintf(buf, format,...)
Definition: sprintf.c:55
UINT WINAPI MsiViewClose(MSIHANDLE hView)
Definition: msiquery.c:427
UINT WINAPI MsiViewFetch(MSIHANDLE hView, MSIHANDLE *record)
Definition: msiquery.c:385
uint32_t entry
Definition: isohybrid.c:63
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
Definition: dsound.c:943

Referenced by test_system_tables().

◆ find_entryW()

static UINT find_entryW ( MSIHANDLE  hdb,
const WCHAR table,
const WCHAR entry 
)
static

Definition at line 973 of file patch.c.

974 {
975  static const WCHAR fmt[] =
976  {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','`','%','s','`',' ',
977  'W','H','E','R','E',' ','`','N','a','m','e','`',' ','=',' ','\'','%','s','\'',0};
978  WCHAR query[0x100];
979  MSIHANDLE hview, hrec;
980  UINT r;
981 
982  wsprintfW( query, fmt, table, entry );
983  r = MsiDatabaseOpenViewW( hdb, query, &hview );
984  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
985 
986  r = MsiViewExecute( hview, 0 );
987  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
988 
989  r = MsiViewFetch( hview, &hrec );
990  MsiViewClose( hview );
991  MsiCloseHandle( hview );
992  MsiCloseHandle( hrec );
993  return r;
994 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
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
unsigned long MSIHANDLE
Definition: msiserver.idl:25
UINT WINAPI MsiViewClose(MSIHANDLE hView)
Definition: msiquery.c:427
__wchar_t WCHAR
Definition: xmlstorage.h:180
UINT WINAPI MsiViewFetch(MSIHANDLE hView, MSIHANDLE *record)
Definition: msiquery.c:385
uint32_t entry
Definition: isohybrid.c:63
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 MsiDatabaseOpenViewW(MSIHANDLE hdb, LPCWSTR szQuery, MSIHANDLE *phView)
Definition: msiquery.c:241
Definition: dsound.c:943

Referenced by test_system_tables().

◆ get_integer()

static INT get_integer ( MSIHANDLE  hdb,
UINT  field,
const char query 
)
static

Definition at line 996 of file patch.c.

997 {
998  UINT r;
999  INT ret = -1;
1000  MSIHANDLE hview, hrec;
1001 
1002  r = MsiDatabaseOpenViewA( hdb, query, &hview );
1003  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
1004 
1005  r = MsiViewExecute( hview, 0 );
1006  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
1007 
1008  r = MsiViewFetch( hview, &hrec );
1009  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
1010  if (r == ERROR_SUCCESS)
1011  {
1012  UINT r_tmp;
1013  ret = MsiRecordGetInteger( hrec, field );
1014  MsiCloseHandle( hrec );
1015 
1016  r_tmp = MsiViewFetch( hview, &hrec );
1017  ok( r_tmp == ERROR_NO_MORE_ITEMS, "expected ERROR_NO_MORE_ITEMS, got %u\n", r);
1018  }
1019 
1020  MsiViewClose( hview );
1021  MsiCloseHandle( hview );
1022  return ret;
1023 }
UINT WINAPI MsiViewExecute(MSIHANDLE hView, MSIHANDLE hRec)
Definition: msiquery.c:459
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
int WINAPI MsiRecordGetInteger(MSIHANDLE handle, UINT iField)
Definition: record.c:271
UINT WINAPI MsiDatabaseOpenViewA(MSIHANDLE hdb, LPCSTR szQuery, MSIHANDLE *phView)
Definition: msiquery.c:88
int32_t INT
Definition: typedefs.h:56
unsigned long MSIHANDLE
Definition: msiserver.idl:25
UINT WINAPI MsiViewClose(MSIHANDLE hView)
Definition: msiquery.c:427
Definition: parser.c:43
UINT WINAPI MsiViewFetch(MSIHANDLE hView, MSIHANDLE *record)
Definition: msiquery.c:385
int ret
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50

Referenced by test_system_tables().

◆ get_pf_file_size()

static DWORD get_pf_file_size ( const char filename)
static

Definition at line 241 of file patch.c.

242 {
243  char path[MAX_PATH];
244  HANDLE file;
245  DWORD size;
246 
248  strcat( path, "\\");
249  strcat( path, filename );
250 
252  if (file == INVALID_HANDLE_VALUE)
253  return INVALID_FILE_SIZE;
254 
255  size = GetFileSize( file, NULL );
256  CloseHandle( file );
257  return size;
258 }
#define CloseHandle
Definition: compat.h:406
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
#define INVALID_FILE_SIZE
Definition: winbase.h:529
const char * filename
Definition: ioapi.h:135
#define FILE_SHARE_READ
Definition: compat.h:125
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:434
GLsizeiptr size
Definition: glext.h:5919
#define MAX_PATH
Definition: compat.h:26
const char file[]
Definition: icontest.c:11
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:481
#define GENERIC_READ
Definition: compat.h:124
static char PROG_FILES_DIR[MAX_PATH]
Definition: patch.c:49
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:407
Definition: fci.c:126

Referenced by test_simple_patch().

◆ get_program_files_dir()

static BOOL get_program_files_dir ( char buf,
char buf2 
)
static

Definition at line 182 of file patch.c.

183 {
184  HKEY hkey;
185  DWORD type, size;
186 
187  if (RegOpenKeyA( HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion", &hkey ))
188  return FALSE;
189 
190  size = MAX_PATH;
191  if (RegQueryValueExA( hkey, "ProgramFilesDir (x86)", 0, &type, (LPBYTE)buf, &size ) &&
192  RegQueryValueExA( hkey, "ProgramFilesDir", 0, &type, (LPBYTE)buf, &size ))
193  {
194  RegCloseKey( hkey );
195  return FALSE;
196  }
197  size = MAX_PATH;
198  if (RegQueryValueExA( hkey, "CommonFilesDir", 0, &type, (LPBYTE)buf2, &size ))
199  {
200  RegCloseKey( hkey );
201  return FALSE;
202  }
203  RegCloseKey( hkey );
204  return TRUE;
205 }
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
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
GLsizeiptr size
Definition: glext.h:5919
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by START_TEST().

◆ get_string()

static char* get_string ( MSIHANDLE  hdb,
UINT  field,
const char query 
)
static

Definition at line 1025 of file patch.c.

1026 {
1027  UINT r;
1028  static char ret[MAX_PATH];
1029  MSIHANDLE hview, hrec;
1030 
1031  ret[0] = '\0';
1032 
1033  r = MsiDatabaseOpenViewA( hdb, query, &hview );
1034  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
1035 
1036  r = MsiViewExecute( hview, 0 );
1037  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
1038 
1039  r = MsiViewFetch( hview, &hrec );
1040  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
1041  if (r == ERROR_SUCCESS)
1042  {
1043  UINT size = MAX_PATH;
1044  r = MsiRecordGetStringA( hrec, field, ret, &size );
1045  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r);
1046  MsiCloseHandle( hrec );
1047 
1048  r = MsiViewFetch( hview, &hrec );
1049  ok( r == ERROR_NO_MORE_ITEMS, "expected ERROR_NO_MORE_ITEMS, got %u\n", r);
1050  }
1051 
1052  MsiViewClose( hview );
1053  MsiCloseHandle( hview );
1054  return ret;
1055 }
UINT WINAPI MsiViewExecute(MSIHANDLE hView, MSIHANDLE hRec)
Definition: msiquery.c:459
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
UINT WINAPI MsiRecordGetStringA(MSIHANDLE handle, UINT iField, LPSTR szValue, LPDWORD pcchValue)
Definition: record.c:451
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
GLsizeiptr size
Definition: glext.h:5919
Definition: parser.c:43
UINT WINAPI MsiViewFetch(MSIHANDLE hView, MSIHANDLE *record)
Definition: msiquery.c:385
#define MAX_PATH
Definition: compat.h:26
int ret
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50

Referenced by test_system_tables().

◆ init_function_pointers()

static void init_function_pointers ( void  )
static

Definition at line 145 of file patch.c.

146 {
147  HMODULE hmsi = GetModuleHandleA( "msi.dll" );
148  HMODULE hadvapi32 = GetModuleHandleA( "advapi32.dll" );
149 
150 #define GET_PROC( mod, func ) \
151  p ## func = (void *)GetProcAddress( mod, #func ); \
152  if (!p ## func) \
153  trace( "GetProcAddress(%s) failed\n", #func );
154 
155  GET_PROC( hmsi, MsiApplyPatchA );
156  GET_PROC( hmsi, MsiGetPatchInfoExA );
157  GET_PROC( hmsi, MsiEnumPatchesExA );
158 
159  GET_PROC( hadvapi32, OpenProcessToken );
160 #undef GET_PROC
161 }
UINT WINAPI MsiGetPatchInfoExA(LPCSTR szPatchCode, LPCSTR szProductCode, LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext, LPCSTR szProperty, LPSTR lpValue, DWORD *pcchValue)
Definition: msi.c:1614
#define GET_PROC(mod, func)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
UINT WINAPI MsiApplyPatchA(LPCSTR szPatchPackage, LPCSTR szInstallPackage, INSTALLTYPE eInstallType, LPCSTR szCommandLine)
Definition: msi.c:280
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

Referenced by START_TEST().

◆ is_process_limited()

static BOOL is_process_limited ( void  )
static

Definition at line 163 of file patch.c.

164 {
165  HANDLE token;
166 
167  if (!pOpenProcessToken) return FALSE;
168 
169  if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
170  {
171  BOOL ret;
173  DWORD size;
174 
177  return (ret && type == TokenElevationTypeLimited);
178  }
179  return FALSE;
180 }
enum _TOKEN_ELEVATION_TYPE TOKEN_ELEVATION_TYPE
#define CloseHandle
Definition: compat.h:406
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
unsigned int BOOL
Definition: ntddk_ex.h:94
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
GLsizeiptr size
Definition: glext.h:5919
#define TOKEN_QUERY
Definition: setypes.h:874
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1138
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:413

Referenced by test_patch_registration(), test_simple_patch(), and test_system_tables().

◆ set_suminfo()

static void set_suminfo ( const WCHAR filename)
static

Definition at line 269 of file patch.c.

270 {
271  UINT r;
272  MSIHANDLE hsi, hdb;
273 
275  ok( r == ERROR_SUCCESS, "failed to open database %u\n", r );
276 
277  r = MsiGetSummaryInformationA( hdb, NULL, 7, &hsi );
278  ok( r == ERROR_SUCCESS, "failed to open summaryinfo %u\n", r );
279 
280  r = MsiSummaryInfoSetPropertyA( hsi, 2, VT_LPSTR, 0, NULL, "Installation Database" );
281  ok( r == ERROR_SUCCESS, "failed to set summary info %u\n", r );
282 
283  r = MsiSummaryInfoSetPropertyA( hsi, 3, VT_LPSTR, 0, NULL, "Installation Database" );
284  ok( r == ERROR_SUCCESS, "failed to set summary info %u\n", r );
285 
286  r = MsiSummaryInfoSetPropertyA( hsi, 4, VT_LPSTR, 0, NULL, "WineHQ" );
287  ok( r == ERROR_SUCCESS, "failed to set summary info %u\n", r );
288 
289  r = MsiSummaryInfoSetPropertyA( hsi, 7, VT_LPSTR, 0, NULL, ";1033" );
290  ok( r == ERROR_SUCCESS, "failed to set summary info %u\n", r );
291 
292  r = MsiSummaryInfoSetPropertyA( hsi, 9, VT_LPSTR, 0, NULL, "{E528DDD6-4801-4BEC-BBB6-C5EE0FD097E9}" );
293  ok( r == ERROR_SUCCESS, "failed to set summary info %u\n", r );
294 
295  r = MsiSummaryInfoSetPropertyA( hsi, 14, VT_I4, 100, NULL, NULL );
296  ok( r == ERROR_SUCCESS, "failed to set summary info %u\n", r );
297 
298  r = MsiSummaryInfoSetPropertyA( hsi, 15, VT_I4, 0, NULL, NULL );
299  ok( r == ERROR_SUCCESS, "failed to set summary info %u\n", r );
300 
301  r = MsiSummaryInfoPersist( hsi );
302  ok( r == ERROR_SUCCESS, "failed to persist suminfo %u\n", r );
303 
304  r = MsiCloseHandle( hsi );
305  ok( r == ERROR_SUCCESS, "failed to close suminfo %u\n", r );
306 
307  r = MsiCloseHandle( hdb );
308  ok( r == ERROR_SUCCESS, "failed to close database %u\n", r );
309 }
Definition: compat.h:1947
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define MSIDBOPEN_DIRECT
Definition: msiquery.h:68
const char * filename
Definition: ioapi.h:135
unsigned long MSIHANDLE
Definition: msiserver.idl:25
UINT WINAPI MsiSummaryInfoSetPropertyA(MSIHANDLE handle, UINT uiProperty, UINT uiDataType, INT iValue, FILETIME *pftValue, LPCSTR szValue)
Definition: suminfo.c:863
smooth NULL
Definition: ftsmooth.c:416
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
UINT WINAPI MsiOpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIHANDLE *phDB)
Definition: database.c:303
unsigned int UINT
Definition: ndis.h:50
UINT WINAPI MsiSummaryInfoPersist(MSIHANDLE handle)
Definition: suminfo.c:1152

Referenced by create_database().

◆ START_TEST()

START_TEST ( patch  )

Definition at line 1353 of file patch.c.

1354 {
1355  DWORD len;
1356  char temp_path[MAX_PATH], prev_path[MAX_PATH];
1357 
1359 
1360  GetCurrentDirectoryA( MAX_PATH, prev_path );
1363 
1365  len = strlen( CURR_DIR );
1366 
1367  if (len && (CURR_DIR[len - 1] == '\\'))
1368  CURR_DIR[len - 1] = 0;
1369 
1371 
1376 
1377  SetCurrentDirectoryA( prev_path );
1378 }
static BOOL get_program_files_dir(char *buf, char *buf2)
Definition: patch.c:182
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static char CURR_DIR[MAX_PATH]
Definition: patch.c:48
static void test_patch_registration(void)
Definition: patch.c:1251
static char COMMON_FILES_DIR[MAX_PATH]
Definition: patch.c:50
static void test_simple_patch(void)
Definition: patch.c:717
static void init_function_pointers(void)
Definition: patch.c:145
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
static void test_MsiOpenDatabase(void)
Definition: patch.c:910
BOOL WINAPI SetCurrentDirectoryA(IN LPCSTR lpPathName)
Definition: path.c:2205
GLenum GLsizei len
Definition: glext.h:6722
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2053
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2145
static char PROG_FILES_DIR[MAX_PATH]
Definition: patch.c:49
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
static void test_system_tables(void)
Definition: patch.c:1057
char temp_path[MAX_PATH]
Definition: mspatcha.c:123

◆ test_MsiOpenDatabase()

static void test_MsiOpenDatabase ( void  )
static

Definition at line 910 of file patch.c.

911 {
912  UINT r;
913  MSIHANDLE hdb;
914 
916  ok(r == ERROR_SUCCESS, "failed to open database %u\n", r);
917 
918  r = MsiDatabaseCommit( hdb );
919  ok(r == ERROR_SUCCESS, "failed to commit database %u\n", r);
920  MsiCloseHandle( hdb );
921 
923  ok(r == ERROR_OPEN_FAILED, "expected ERROR_OPEN_FAILED, got %u\n", r);
924  DeleteFileA( mspfile );
925 
927  ok(r == ERROR_SUCCESS , "failed to open database %u\n", r);
928 
929  r = MsiDatabaseCommit( hdb );
930  ok(r == ERROR_SUCCESS, "failed to commit database %u\n", r);
931  MsiCloseHandle( hdb );
932 
934  ok(r == ERROR_SUCCESS, "failed to open database %u\n", r);
935  MsiCloseHandle( hdb );
936  DeleteFileA( mspfile );
937 
938  create_database( msifile, tables, sizeof(tables) / sizeof(struct msi_table) );
940 
942  ok(r == ERROR_OPEN_FAILED, "failed to open database %u\n", r );
943 
945  ok(r == ERROR_SUCCESS, "failed to open database %u\n", r );
946  MsiCloseHandle( hdb );
947 
948  DeleteFileA( msifile );
949  DeleteFileA( mspfile );
950 }
#define MSIDBOPEN_READONLY
Definition: msiquery.h:66
#define ERROR_SUCCESS
Definition: deptool.c:10
#define MSIDBOPEN_PATCHFILE
Definition: msiquery.h:79
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static const WCHAR msifileW[]
Definition: patch.c:43
static const WCHAR mspfileW[]
Definition: patch.c:45
unsigned long MSIHANDLE
Definition: msiserver.idl:25
static void create_database(const char *filename, const struct msi_table *tables, UINT num_tables)
Definition: patch.c:311
static const struct msi_table tables[]
Definition: patch.c:133
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
static void create_patch(const char *filename)
Definition: patch.c:671
#define MSIDBOPEN_CREATE
Definition: msiquery.h:69
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
#define ERROR_OPEN_FAILED
Definition: winerror.h:184
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
static const char * mspfile
Definition: patch.c:42
static const char * msifile
Definition: patch.c:41

Referenced by START_TEST().

◆ test_patch_registration()

static void test_patch_registration ( void  )
static

Definition at line 1251 of file patch.c.

1252 {
1253  UINT r, size;
1254  char buffer[MAX_PATH], patch_code[39];
1255 
1256  if (!pMsiApplyPatchA || !pMsiGetPatchInfoExA || !pMsiEnumPatchesExA)
1257  {
1258  win_skip("required functions not available\n");
1259  return;
1260  }
1261  if (is_process_limited())
1262  {
1263  skip("process is limited\n");
1264  return;
1265  }
1266 
1267  CreateDirectoryA( "msitest", NULL );
1268  create_file( "msitest\\patch.txt", 1000 );
1269 
1270  create_database( msifile, tables, sizeof(tables) / sizeof(struct msi_table) );
1271  create_patch( mspfile );
1272 
1274 
1276  if (r != ERROR_SUCCESS)
1277  {
1278  skip("Product installation failed with error code %d\n", r);
1279  goto cleanup;
1280  }
1281 
1283  ok( r == ERROR_SUCCESS || broken( r == ERROR_PATCH_PACKAGE_INVALID ), /* version 2.0 */
1284  "expected ERROR_SUCCESS, got %u\n", r );
1285 
1287  {
1288  win_skip("Windows Installer < 3.0 detected\n");
1289  goto uninstall;
1290  }
1291 
1292  buffer[0] = 0;
1293  size = sizeof(buffer);
1294  r = pMsiGetPatchInfoExA( "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}",
1295  "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}",
1298  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
1299  ok( buffer[0], "buffer empty\n" );
1300 
1301  buffer[0] = 0;
1302  size = sizeof(buffer);
1303  r = pMsiGetPatchInfoExA( "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}",
1304  "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}",
1307  ok( r == ERROR_UNKNOWN_PRODUCT, "expected ERROR_UNKNOWN_PRODUCT, got %u\n", r );
1308 
1309  buffer[0] = 0;
1310  size = sizeof(buffer);
1311  r = pMsiGetPatchInfoExA( "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}",
1312  "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}",
1315  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
1316  ok( !buffer[0], "got %s\n", buffer );
1317 
1318  r = pMsiEnumPatchesExA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}",
1320  0, patch_code, NULL, NULL, NULL, NULL );
1321  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
1322  ok( !strcmp( patch_code, "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}" ), "wrong patch code\n" );
1323 
1324  r = pMsiEnumPatchesExA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}",
1326  0, patch_code, NULL, NULL, NULL, NULL );
1327  ok( r == ERROR_NO_MORE_ITEMS, "expected ERROR_NO_MORE_ITEMS, got %u\n", r );
1328 
1329  r = pMsiEnumPatchesExA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}",
1331  0, patch_code, NULL, NULL, NULL, NULL );
1332  ok( r == ERROR_NO_MORE_ITEMS, "expected ERROR_NO_MORE_ITEMS, got %u\n", r );
1333 
1334 uninstall:
1335  r = MsiInstallProductA( msifile, "REMOVE=ALL" );
1336  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
1337 
1338  buffer[0] = 0;
1339  size = sizeof(buffer);
1340  r = pMsiGetPatchInfoExA( "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}",
1341  "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}",
1344  ok( r == ERROR_UNKNOWN_PRODUCT, "expected ERROR_UNKNOWN_PRODUCT, got %u\n", r );
1345 
1346 cleanup:
1347  DeleteFileA( msifile );
1348  DeleteFileA( mspfile );
1349  DeleteFileA( "msitest\\patch.txt" );
1350  RemoveDirectoryA( "msitest" );
1351 }
static BOOL is_process_limited(void)
Definition: patch.c:163
#define ERROR_SUCCESS
Definition: deptool.c:10
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:205
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint buffer
Definition: glext.h:5915
#define create_file(name, size)
Definition: patch.c:225
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2313
static void create_database(const char *filename, const struct msi_table *tables, UINT num_tables)
Definition: patch.c:311
#define ERROR_PATCH_PACKAGE_INVALID
Definition: winerror.h:994
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
static const struct msi_table tables[]
Definition: patch.c:133
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
static void create_patch(const char *filename)
Definition: patch.c:671
GLsizeiptr size
Definition: glext.h:5919
#define ERROR_UNKNOWN_PRODUCT
Definition: winerror.h:963
#define MAX_PATH
Definition: compat.h:26
#define broken(x)
Definition: _sntprintf.h:21
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
unsigned int UINT
Definition: ndis.h:50
#define skip(...)
Definition: atltest.h:64
static const char * mspfile
Definition: patch.c:42
#define INSTALLPROPERTY_LOCALPACKAGEA
Definition: msi.h:342
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
char * cleanup(char *str)
Definition: wpickclick.c:99
static const char * msifile
Definition: patch.c:41
UINT WINAPI MsiApplyPatchA(LPCSTR szPatchPackage, LPCSTR szInstallPackage, INSTALLTYPE eInstallType, LPCSTR szCommandLine)
Definition: msi.c:280
#define win_skip
Definition: test.h:150

Referenced by START_TEST().

◆ test_simple_patch()

static void test_simple_patch ( void  )
static

Definition at line 717 of file patch.c.

718 {
719  UINT r;
720  DWORD size;
721  char path[MAX_PATH], install_source[MAX_PATH], buffer[32];
722  const char *query;
723  WCHAR pathW[MAX_PATH];
724  MSIHANDLE hpackage, hdb, hview, hrec;
725 
726  if (!pMsiApplyPatchA)
727  {
728  win_skip("MsiApplyPatchA is not available\n");
729  return;
730  }
731  if (is_process_limited())
732  {
733  skip("process is limited\n");
734  return;
735  }
736 
737  CreateDirectoryA( "msitest", NULL );
738  create_file( "msitest\\patch.txt", 1000 );
739 
740  create_database( msifile, tables, sizeof(tables) / sizeof(struct msi_table) );
742 
744 
746  if (r != ERROR_SUCCESS)
747  {
748  skip("Product installation failed with error code %u\n", r);
749  goto cleanup;
750  }
751 
752  size = get_pf_file_size( "msitest\\patch.txt" );
753  ok( size == 1000, "expected 1000, got %u\n", size );
754 
755  size = sizeof(install_source);
756  r = MsiGetProductInfoA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}",
757  "InstallSource", install_source, &size );
758  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
759 
760  strcpy( path, CURR_DIR );
761  strcat( path, "\\" );
762  strcat( path, msifile );
763 
764  r = MsiOpenPackageA( path, &hpackage );
765  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
766 
767  hdb = MsiGetActiveDatabase( hpackage );
768  ok( hdb, "failed to get database handle\n" );
769 
770  query = "SELECT * FROM `Property` where `Property` = 'PATCHNEWPACKAGECODE'";
771  r = MsiDatabaseOpenViewA( hdb, query, &hview );
772  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
773 
774  r = MsiViewExecute( hview, 0 );
775  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
776 
777  r = MsiViewFetch( hview, &hrec );
778  ok( r == ERROR_NO_MORE_ITEMS, "expected ERROR_NO_MORE_ITEMS, got %u\n", r );
779 
780  MsiCloseHandle( hrec );
781  MsiViewClose( hview );
782  MsiCloseHandle( hview );
783 
784  query = "SELECT * FROM `Property` WHERE `Property` = 'PATCHNEWSUMMARYSUBJECT' "
785  "AND `Value` = 'Installer Database'";
786  r = MsiDatabaseOpenViewA( hdb, query, &hview );
787  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
788 
789  r = MsiViewExecute( hview, 0 );
790  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
791 
792  r = MsiViewFetch( hview, &hrec );
793  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
794 
795  MsiCloseHandle( hrec );
796  MsiViewClose( hview );
797  MsiCloseHandle( hview );
798 
799  buffer[0] = 0;
800  size = sizeof(buffer);
801  r = MsiGetPropertyA( hpackage, "PATCHNEWSUMMARYSUBJECT", buffer, &size );
802  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
803  ok( !strcmp( buffer, "Installer Database" ), "expected \'Installer Database\', got \'%s\'\n", buffer );
804 
805  MsiCloseHandle( hdb );
806  MsiCloseHandle( hpackage );
807 
809  ok( r == ERROR_SUCCESS || broken( r == ERROR_PATCH_PACKAGE_INVALID ), /* version 2.0 */
810  "expected ERROR_SUCCESS, got %u\n", r );
811 
813  {
814  win_skip("Windows Installer < 3.0 detected\n");
815  goto uninstall;
816  }
817 
818  size = get_pf_file_size( "msitest\\patch.txt" );
819  ok( size == 1002, "expected 1002, got %u\n", size );
820 
821  /* show that MsiOpenPackage applies registered patches */
822  r = MsiOpenPackageA( path, &hpackage );
823  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
824 
825  hdb = MsiGetActiveDatabase( hpackage );
826  ok( hdb, "failed to get database handle\n" );
827 
828  query = "SELECT * FROM `Property` where `Property` = 'PATCHNEWPACKAGECODE'";
829  r = MsiDatabaseOpenViewA( hdb, query, &hview );
830  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
831 
832  r = MsiViewExecute( hview, 0 );
833  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
834 
835  r = MsiViewFetch( hview, &hrec );
836  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
837 
838  MsiCloseHandle( hrec );
839  MsiViewClose( hview );
840  MsiCloseHandle( hview );
841 
842  query = "SELECT * FROM `Property` WHERE `Property` = 'PATCHNEWSUMMARYSUBJECT' "
843  "AND `Value` = 'Installation Database'";
844  r = MsiDatabaseOpenViewA( hdb, query, &hview );
845  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
846 
847  r = MsiViewExecute( hview, 0 );
848  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
849 
850  r = MsiViewFetch( hview, &hrec );
851  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
852 
853  MsiCloseHandle( hrec );
854  MsiViewClose( hview );
855  MsiCloseHandle( hview );
856 
857  buffer[0] = 0;
858  size = sizeof(buffer);
859  r = MsiGetPropertyA( hpackage, "PATCHNEWSUMMARYSUBJECT", buffer, &size );
860  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
861  ok( !strcmp( buffer, "Installation Database" ), "expected \'Installation Database\', got \'%s\'\n", buffer );
862 
863  MsiCloseHandle( hdb );
864  MsiCloseHandle( hpackage );
865 
866  /* show that patches are not committed to the local package database */
867  size = sizeof(path);
868  r = MsiGetProductInfoA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}",
869  "LocalPackage", path, &size );
870  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
871 
872  MultiByteToWideChar( CP_ACP, 0, path, -1, pathW, MAX_PATH );
873  r = MsiOpenDatabaseW( pathW, MSIDBOPEN_READONLY, &hdb );
874  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
875 
876  r = MsiDatabaseOpenViewA( hdb, query, &hview );
877  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
878 
879  r = MsiViewExecute( hview, 0 );
880  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
881 
882  r = MsiViewFetch( hview, &hrec );
883  ok( r == ERROR_NO_MORE_ITEMS, "expected ERROR_NO_MORE_ITEMS, got %u\n", r );
884 
885  MsiCloseHandle( hrec );
886  MsiViewClose( hview );
887  MsiCloseHandle( hview );
888  MsiCloseHandle( hdb );
889 
890 uninstall:
891  size = sizeof(path);
892  r = MsiGetProductInfoA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}",
893  "InstallSource", path, &size );
894  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
895  ok( !strcasecmp( path, install_source ), "wrong path %s\n", path );
896 
897  r = MsiInstallProductA( msifile, "REMOVE=ALL" );
898  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
899 
900  ok( !delete_pf( "msitest\\patch.txt", TRUE ), "file not removed\n" );
901  ok( !delete_pf( "msitest", FALSE ), "directory not removed\n" );
902 
903 cleanup:
904  DeleteFileA( msifile );
905  DeleteFileA( mspfile );
906  DeleteFileA( "msitest\\patch.txt" );
907  RemoveDirectoryA( "msitest" );
908 }
#define MSIDBOPEN_READONLY
Definition: msiquery.h:66
UINT WINAPI MsiViewExecute(MSIHANDLE hView, MSIHANDLE hRec)
Definition: msiquery.c:459
static BOOL is_process_limited(void)
Definition: patch.c:163
UINT WINAPI MsiOpenPackageA(LPCSTR szPackage, MSIHANDLE *phPackage)
Definition: package.c:1687
#define TRUE
Definition: types.h:120
UINT WINAPI MsiGetPropertyA(MSIHANDLE hInstall, LPCSTR szName, LPSTR szValueBuf, LPDWORD pchValueBuf)
Definition: package.c:2488
#define ERROR_SUCCESS
Definition: deptool.c:10
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
#define strcasecmp
Definition: fake.h:9
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:205
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
GLsizei const GLchar ** path
Definition: glext.h:7234
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define CP_ACP
Definition: compat.h:99
static char CURR_DIR[MAX_PATH]
Definition: patch.c:48
GLuint buffer
Definition: glext.h:5915
#define create_file(name, size)
Definition: patch.c:225
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2313
UINT WINAPI MsiDatabaseOpenViewA(MSIHANDLE hdb, LPCSTR szQuery, MSIHANDLE *phView)
Definition: msiquery.c:88
unsigned long MSIHANDLE
Definition: msiserver.idl:25
static void create_database(const char *filename, const struct msi_table *tables, UINT num_tables)
Definition: patch.c:311
UINT WINAPI MsiViewClose(MSIHANDLE hView)
Definition: msiquery.c:427
MSIHANDLE WINAPI MsiGetActiveDatabase(MSIHANDLE hInstall)
Definition: package.c:1692
#define ERROR_PATCH_PACKAGE_INVALID
Definition: winerror.h:994
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
static const struct msi_table tables[]
Definition: patch.c:133
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
static void create_patch(const char *filename)
Definition: patch.c:671
static DWORD get_pf_file_size(const char *filename)
Definition: patch.c:241
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
UINT WINAPI MsiViewFetch(MSIHANDLE hView, MSIHANDLE *record)
Definition: msiquery.c:385
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
#define broken(x)
Definition: _sntprintf.h:21
#define ok(value,...)
Definition: atltest.h:57
UINT WINAPI MsiOpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIHANDLE *phDB)
Definition: database.c:303
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
static BOOL delete_pf(const char *rel_path, BOOL is_file)
Definition: patch.c:227
unsigned int UINT
Definition: ndis.h:50
#define MultiByteToWideChar
Definition: compat.h:100
#define skip(...)
Definition: atltest.h:64
static const char * mspfile
Definition: patch.c:42
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
char * cleanup(char *str)
Definition: wpickclick.c:99
static const char * msifile
Definition: patch.c:41
UINT WINAPI MsiApplyPatchA(LPCSTR szPatchPackage, LPCSTR szInstallPackage, INSTALLTYPE eInstallType, LPCSTR szCommandLine)
Definition: msi.c:280
UINT WINAPI MsiGetProductInfoA(LPCSTR szProduct, LPCSTR szAttribute, LPSTR szBuffer, LPDWORD pcchValueBuf)
Definition: msi.c:1270
#define win_skip
Definition: test.h:150
GLenum query
Definition: glext.h:7781

Referenced by START_TEST().

◆ test_system_tables()

static void test_system_tables ( void  )
static

Definition at line 1057 of file patch.c.

1058 {
1059  static const char patchsource[] = "MSPSRC0F96CDC04CDF4304B2837B9264889EF7";
1060  static const WCHAR streamsW[] = {'_','S','t','r','e','a','m','s',0};
1061  static const WCHAR CAB_msitest_encodedW[] = {0x3a8c,0x47cb,0x45b0,0x45ec,0x45a8,0x4837,0};
1062  UINT r;
1063  char *cr;
1064  const char *query;
1065  MSIHANDLE hproduct, hdb, hview, hrec;
1066 
1067  if (!pMsiApplyPatchA)
1068  {
1069  win_skip("MsiApplyPatchA is not available\n");
1070  return;
1071  }
1072  if (is_process_limited())
1073  {
1074  skip("process is limited\n");
1075  return;
1076  }
1077 
1078  CreateDirectoryA( "msitest", NULL );
1079  create_file( "msitest\\patch.txt", 1000 );
1080 
1081  create_database( msifile, tables, sizeof(tables) / sizeof(struct msi_table) );
1082  create_patch( mspfile );
1083 
1085 
1087  if (r != ERROR_SUCCESS)
1088  {
1089  skip("Product installation failed with error code %d\n", r);
1090  goto cleanup;
1091  }
1092 
1093  r = MsiOpenProductA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}", &hproduct );
1094  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
1095 
1096  hdb = MsiGetActiveDatabase( hproduct );
1097  ok( hdb, "failed to get database handle\n" );
1098 
1099  r = find_entry( hdb, "_Streams", "\5SummaryInformation" );
1100  ok( r == ERROR_SUCCESS, "failed to find entry %u\n", r );
1101 
1102  query = "SELECT * FROM `_Storages`";
1103  r = MsiDatabaseOpenViewA( hdb, query, &hview );
1104  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
1105 
1106  r = MsiViewExecute( hview, 0 );
1107  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
1108 
1109  r = MsiViewFetch( hview, &hrec );
1110  ok( r == ERROR_NO_MORE_ITEMS, "expected ERROR_NO_MORE_ITEMS, got %u\n", r );
1111 
1112  r = find_entry( hdb, "_Tables", "Directory" );
1113  ok( r == ERROR_SUCCESS, "failed to find entry %u\n", r );
1114 
1115  r = find_entry( hdb, "_Tables", "File" );
1116  ok( r == ERROR_SUCCESS, "failed to find entry %u\n", r );
1117 
1118  r = find_entry( hdb, "_Tables", "Component" );
1119  ok( r == ERROR_SUCCESS, "failed to find entry %u\n", r );
1120 
1121  r = find_entry( hdb, "_Tables", "Feature" );
1122  ok( r == ERROR_SUCCESS, "failed to find entry %u\n", r );
1123 
1124  r = find_entry( hdb, "_Tables", "FeatureComponents" );
1125  ok( r == ERROR_SUCCESS, "failed to find entry %u\n", r );
1126 
1127  r = find_entry( hdb, "_Tables", "Property" );
1128  ok( r == ERROR_SUCCESS, "failed to find entry %u\n", r );
1129 
1130  r = find_entry( hdb, "_Tables", "InstallExecuteSequence" );
1131  ok( r == ERROR_SUCCESS, "failed to find entry %u\n", r );
1132 
1133  r = find_entry( hdb, "_Tables", "Media" );
1134  ok( r == ERROR_SUCCESS, "failed to find entry %u\n", r );
1135 
1136  r = get_integer( hdb, 1, "SELECT * FROM `Media` WHERE `VolumeLabel`=\'DISK1\'");
1137  ok( r == 1, "Got %u\n", r );
1138 
1139  r = find_entry( hdb, "_Tables", "_Property" );
1140  ok( r == ERROR_SUCCESS, "failed to find entry %u\n", r );
1141 
1142  MsiCloseHandle( hrec );
1143  MsiViewClose( hview );
1144  MsiCloseHandle( hview );
1145  MsiCloseHandle( hdb );
1146  MsiCloseHandle( hproduct );
1147 
1149  ok( r == ERROR_SUCCESS || broken( r == ERROR_PATCH_PACKAGE_INVALID ), /* version 2.0 */
1150  "expected ERROR_SUCCESS, got %u\n", r );
1151 
1153  {
1154  win_skip("Windows Installer < 3.0 detected\n");
1155  goto uninstall;
1156  }
1157 
1158  r = MsiOpenProductA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}", &hproduct );
1159  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
1160 
1161  hdb = MsiGetActiveDatabase( hproduct );
1162  ok( hdb, "failed to get database handle\n" );
1163 
1164  r = find_entry( hdb, "_Streams", "\5SummaryInformation" );
1165  ok( r == ERROR_SUCCESS, "failed to find entry %u\n", r );
1166 
1167  r = find_entryW( hdb, streamsW, CAB_msitest_encodedW );
1168  ok( r == ERROR_NO_MORE_ITEMS, "failed to find entry %u\n", r );
1169 
1170  query = "SELECT * FROM `_Storages`";
1171  r = MsiDatabaseOpenViewA( hdb, query, &hview );
1172  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
1173 
1174  r = MsiViewExecute( hview, 0 );
1175  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
1176 
1177  r = MsiViewFetch( hview, &hrec );
1178  ok( r == ERROR_NO_MORE_ITEMS, "expected ERROR_NO_MORE_ITEMS, got %u\n", r );
1179 
1180  r = find_entry( hdb, "_Tables", "Directory" );
1181  ok( r == ERROR_SUCCESS, "failed to find entry %u\n", r );
1182 
1183  r = find_entry( hdb, "_Tables", "File" );
1184  ok( r == ERROR_SUCCESS, "failed to find entry %u\n", r );
1185 
1186  r = find_entry( hdb, "_Tables", "Component" );
1187  ok( r == ERROR_SUCCESS, "failed to find entry %u\n", r );
1188 
1189  r = find_entry( hdb, "_Tables", "Feature" );
1190  ok( r == ERROR_SUCCESS, "failed to find entry %u\n", r );
1191 
1192  r = find_entry( hdb, "_Tables", "FeatureComponents" );
1193  ok( r == ERROR_SUCCESS, "failed to find entry %u\n", r );
1194 
1195  r = find_entry( hdb, "_Tables", "Property" );
1196  ok( r == ERROR_SUCCESS, "failed to find entry %u\n", r );
1197 
1198  r = find_entry( hdb, "_Tables", "InstallExecuteSequence" );
1199  ok( r == ERROR_SUCCESS, "failed to find entry %u\n", r );
1200 
1201  r = find_entry( hdb, "_Tables", "Media" );
1202  ok( r == ERROR_SUCCESS, "failed to find entry %u\n", r );
1203 
1204  r = find_entry( hdb, "_Tables", "_Property" );
1205  ok( r == ERROR_SUCCESS, "failed to find entry %u\n", r );
1206 
1207  r = find_entry( hdb, "_Tables", "MsiPatchHeaders" );
1208  ok( r == ERROR_SUCCESS, "failed to find entry %u\n", r );
1209 
1210  r = find_entry( hdb, "_Tables", "Patch" );
1211  ok( r == ERROR_SUCCESS, "failed to find entry %u\n", r );
1212 
1213  r = find_entry( hdb, "_Tables", "PatchPackage" );
1214  ok( r == ERROR_SUCCESS, "failed to find entry %u\n", r );
1215 
1216  cr = get_string( hdb, 6, "SELECT * FROM `Media` WHERE `Source` IS NOT NULL");
1217  todo_wine ok( !strcmp(cr, patchsource), "Expected \"%s\", got \"%s\"\n", patchsource, cr );
1218 
1219  r = get_integer( hdb, 1, "SELECT * FROM `Media` WHERE `Source` IS NOT NULL");
1220  todo_wine ok( r == 100, "Got %u\n", r );
1221 
1222  r = get_integer( hdb, 2, "SELECT * FROM `Media` WHERE `Source` IS NOT NULL");
1223  todo_wine ok( r == 10000, "Got %u\n", r );
1224 
1225  r = get_integer( hdb, 1, "SELECT * FROM `Media` WHERE `VolumeLabel`=\'DISK1\'");
1226  ok( r == 1, "Got %u\n", r );
1227 
1228  cr = get_string( hdb, 4, "SELECT * FROM `Media` WHERE `Source` IS NOT NULL");
1229  ok( !strcmp(cr, "#CAB_msitest"), "Expected \"#CAB_msitest\", got \"%s\"\n", cr );
1230 
1231  r = get_integer( hdb, 8, "SELECT * FROM `File` WHERE `File` = 'patch.txt'");
1232  ok( r == 10000, "Got %u\n", r );
1233 
1234  MsiCloseHandle( hrec );
1235  MsiViewClose( hview );
1236  MsiCloseHandle( hview );
1237  MsiCloseHandle( hdb );
1238  MsiCloseHandle( hproduct );
1239 
1240 uninstall:
1241  r = MsiInstallProductA( msifile, "REMOVE=ALL" );
1242  ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
1243 
1244 cleanup:
1245  DeleteFileA( msifile );
1246  DeleteFileA( mspfile );
1247  DeleteFileA( "msitest\\patch.txt" );
1248  RemoveDirectoryA( "msitest" );
1249 }
static UINT find_entryW(MSIHANDLE hdb, const WCHAR *table, const WCHAR *entry)
Definition: patch.c:973
UINT WINAPI MsiViewExecute(MSIHANDLE hView, MSIHANDLE hRec)
Definition: msiquery.c:459
static BOOL is_process_limited(void)
Definition: patch.c:163
#define ERROR_SUCCESS
Definition: deptool.c:10
static UINT find_entry(MSIHANDLE hdb, const char *table, const char *entry)
Definition: patch.c:952
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
Definition: msi.c:205
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define create_file(name, size)
Definition: patch.c:225
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2313
UINT WINAPI MsiDatabaseOpenViewA(MSIHANDLE hdb, LPCSTR szQuery, MSIHANDLE *phView)
Definition: msiquery.c:88
static INT get_integer(MSIHANDLE hdb, UINT field, const char *query)
Definition: patch.c:996
unsigned long MSIHANDLE
Definition: msiserver.idl:25
static void create_database(const char *filename, const struct msi_table *tables, UINT num_tables)
Definition: patch.c:311
UINT WINAPI MsiViewClose(MSIHANDLE hView)
Definition: msiquery.c:427
MSIHANDLE WINAPI MsiGetActiveDatabase(MSIHANDLE hInstall)
Definition: package.c:1692
#define ERROR_PATCH_PACKAGE_INVALID
Definition: winerror.h:994
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
static const struct msi_table tables[]
Definition: patch.c:133
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
static char * get_string(MSIHANDLE hdb, UINT field, const char *query)
Definition: patch.c:1025
static void create_patch(const char *filename)
Definition: patch.c:671
UINT WINAPI MsiOpenProductA(LPCSTR szProduct, MSIHANDLE *phProduct)
Definition: msi.c:81
__wchar_t WCHAR
Definition: xmlstorage.h:180
UINT WINAPI MsiViewFetch(MSIHANDLE hView, MSIHANDLE *record)
Definition: msiquery.c:385
#define todo_wine
Definition: test.h:163
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
#define broken(x)
Definition: _sntprintf.h:21
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
unsigned int UINT
Definition: ndis.h:50
#define skip(...)
Definition: atltest.h:64
static const char * mspfile
Definition: patch.c:42
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
char * cleanup(char *str)
Definition: wpickclick.c:99
static const char * msifile
Definition: patch.c:41
UINT WINAPI MsiApplyPatchA(LPCSTR szPatchPackage, LPCSTR szInstallPackage, INSTALLTYPE eInstallType, LPCSTR szCommandLine)
Definition: msi.c:280
#define win_skip
Definition: test.h:150
GLenum query
Definition: glext.h:7781

Referenced by START_TEST().

◆ UINT()

static UINT ( WINAPI pMsiApplyPatchA)
static

◆ write_file()

static void write_file ( const char filename,
const char data,
DWORD  data_size 
)
static

Definition at line 260 of file patch.c.

261 {
262  DWORD size;
265  WriteFile( file, data, data_size, &size, NULL );
266  CloseHandle( file );
267 }
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:406
const char * filename
Definition: ioapi.h:135
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define CREATE_ALWAYS
Definition: disk.h:72
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:407
Definition: fci.c:126

Referenced by create_database().

◆ write_tables()

static void write_tables ( IStorage stg,
const struct table_data tables,
UINT  num_tables 
)
static

Definition at line 649 of file patch.c.

650 {
651  IStream *stm;
652  DWORD i, count;
653  HRESULT r;
654 
655  for (i = 0; i < num_tables; i++)
656  {
657  r = IStorage_CreateStream( stg, tables[i].name, STGM_WRITE|STGM_SHARE_EXCLUSIVE, 0, 0, &stm );
658  if (FAILED( r ))
659  {
660  ok( 0, "failed to create stream 0x%08x\n", r );
661  continue;
662  }
663 
664  r = IStream_Write( stm, tables[i].data, tables[i].size, &count );
665  if (FAILED( r ) || count != tables[i].size)
666  ok( 0, "failed to write stream\n" );
667  IStream_Release( stm );
668  }
669 }
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:922
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint GLuint GLsizei count
Definition: gl.h:1545
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
static const struct msi_table tables[]
Definition: patch.c:133
#define STGM_WRITE
Definition: objbase.h:917
GLsizeiptr size
Definition: glext.h:5919
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define ok(value,...)
Definition: atltest.h:57
Definition: name.c:38

Referenced by create_patch().

Variable Documentation

◆ COMMON_FILES_DIR

char COMMON_FILES_DIR[MAX_PATH]
static

Definition at line 50 of file patch.c.

Referenced by START_TEST().

◆ component_dat

const char component_dat[]
static
Initial value:
=
"Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
"s72\tS38\ts72\ti2\tS255\tS72\n"
"Component\tComponent\n"
"patch\t{4B79D87E-6D28-4FD3-92D6-CD9B26AF64F1}\tMSITESTDIR\t0\t\tpatch.txt\n"

Definition at line 87 of file patch.c.

◆ CURR_DIR

char CURR_DIR[MAX_PATH]
static

Definition at line 48 of file patch.c.

Referenced by create_database(), START_TEST(), and test_simple_patch().

◆ directory_dat

const char directory_dat[]
static
Initial value:
=
"Directory\tDirectory_Parent\tDefaultDir\n"
"s72\tS72\tl255\n"
"Directory\tDirectory\n"
"MSITESTDIR\tProgramFilesFolder\tmsitest\n"
"ProgramFilesFolder\tTARGETDIR\t.\n"
"TARGETDIR\t\tSourceDir"

Definition at line 79 of file patch.c.

◆ DWORD

Definition at line 37 of file patch.c.

◆ feature_comp_dat

const char feature_comp_dat[]
static
Initial value:
=
"Feature_\tComponent_\n"
"s38\ts72\n"
"FeatureComponents\tFeature_\tComponent_\n"
"patch\tpatch\n"

Definition at line 99 of file patch.c.

◆ feature_dat

const char feature_dat[]
static
Initial value:
=
"Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
"s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
"Feature\tFeature\n"
"patch\t\t\tpatch feature\t1\t1\tMSITESTDIR\t0\n"

Definition at line 93 of file patch.c.

◆ file_dat

const char file_dat[]
static
Initial value:
=
"File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
"s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
"File\tFile\n"
"patch.txt\tpatch\tpatch.txt\t1000\t\t\t0\t1\n"

Definition at line 73 of file patch.c.

◆ install_exec_seq_dat

const char install_exec_seq_dat[]
static
Initial value:
=
"Action\tCondition\tSequence\n"
"s72\tS255\tI2\n"
"InstallExecuteSequence\tAction\n"
"LaunchConditions\t\t100\n"
"CostInitialize\t\t800\n"
"FileCost\t\t900\n"
"CostFinalize\t\t1000\n"
"InstallValidate\t\t1400\n"
"InstallInitialize\t\t1500\n"
"ProcessComponents\t\t1600\n"
"RemoveFiles\t\t1700\n"
"InstallFiles\t\t2000\n"
"RegisterUser\t\t3000\n"
"RegisterProduct\t\t3100\n"
"PublishFeatures\t\t5100\n"
"PublishProduct\t\t5200\n"
"InstallFinalize\t\t6000\n"

Definition at line 105 of file patch.c.

◆ INSTALLTYPE

Definition at line 34 of file patch.c.

◆ LPCSTR

DWORD* static LPCSTR

Definition at line 34 of file patch.c.

◆ LPDWORD

Definition at line 37 of file patch.c.

◆ LPSTR

Definition at line 35 of file patch.c.

◆ media_dat

const char media_dat[]
static
Initial value:
=
"DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
"i2\ti4\tL64\tS255\tS32\tS72\n"
"Media\tDiskId\n"
"1\t1\t\t\tDISK1\t\n"

Definition at line 67 of file patch.c.

◆ msifile

const char* msifile = "winetest-patch.msi"
static

◆ msifileW

const WCHAR msifileW[]
static
Initial value:
=
{'w','i','n','e','t','e','s','t','-','p','a','t','c','h','.','m','s','i',0}

Definition at line 43 of file patch.c.

Referenced by test_MsiOpenDatabase().

◆ MSIINSTALLCONTEXT

Definition at line 35 of file patch.c.

◆ mspfile

const char* mspfile = "winetest-patch.msp"
static

◆ mspfileW

const WCHAR mspfileW[]
static
Initial value:
=
{'w','i','n','e','t','e','s','t','-','p','a','t','c','h','.','m','s','p',0}

Definition at line 45 of file patch.c.

Referenced by test_MsiOpenDatabase().

◆ p_data0

const WCHAR p_data0[]
static
Initial value:
= {
0x0001, 0x0001, 0x0001, 0x0001, 0x8001, 0x8002, 0x8003, 0x8004,
0x0002, 0x0003, 0x0004, 0x0005, 0xad00, 0xbd26, 0x8d00, 0x9502
}

Definition at line 365 of file patch.c.

◆ p_data1

const WCHAR p_data1[]
static
Initial value:
= {
0x0001
}

Definition at line 369 of file patch.c.

◆ p_data2

const char p_data2[]
static
Initial value:
= {
"MsiPatchSequencePatchFamilyProductCodeSequenceAttributes1.1.19388.37230913B8D18FBB64CACA239C74C11E3FA74"
}

Definition at line 372 of file patch.c.

◆ p_data3

const WCHAR p_data3[]
static
Initial value:
= {
0, 0,
16, 5,
11, 1,
11, 1,
8, 1,
10, 1,
15, 1,
32, 1,
}

Definition at line 375 of file patch.c.

◆ p_data4

const char p_data4[]
static
Initial value:
= {
0x4d, 0x53, 0x43, 0x46, 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x9e,
0x03, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x12,
0xea, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87,
0x3c, 0xd4, 0x80, 0x20, 0x00, 0x70, 0x61, 0x74, 0x63, 0x68, 0x2e,
0x74, 0x78, 0x74, 0x00, 0x0b, 0x3c, 0xd6, 0xc1, 0x4a, 0x00, 0xea,
0x03, 0x5b, 0x80, 0x80, 0x8d, 0x00, 0x10, 0xa1, 0x3e, 0x00, 0x00,
0x00, 0x00, 0x03, 0x00, 0x40, 0x30, 0x0c, 0x43, 0xf8, 0xb4, 0x85,
0x4d, 0x96, 0x08, 0x0a, 0x92, 0xf0, 0x52, 0xfb, 0xbb, 0x82, 0xf9,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0e, 0x31, 0x7d,
0x56, 0xdf, 0xf7, 0x48, 0x7c, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x41, 0x80, 0xdf, 0xf7, 0xd8, 0x72, 0xbf, 0xb9, 0x63,
0x91, 0x0e, 0x57, 0x1f, 0xfa, 0x1a, 0x66, 0x54, 0x55
}

Definition at line 386 of file patch.c.

◆ p_data5

const WCHAR p_data5[]
static
Initial value:
= {
0x0007, 0x0000, 0x0006, 0x8000
}

Definition at line 402 of file patch.c.

◆ p_data6

const char p_data6[]
static
Initial value:
= {
0xfe, 0xff, 0x00, 0x00, 0x05, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe0, 0x85, 0x9f, 0xf2, 0xf9,
0x4f, 0x68, 0x10, 0xab, 0x91, 0x08, 0x00, 0x2b, 0x27, 0xb3, 0xd9,
0x30, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00,
0x00, 0x09, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x07, 0x00,
0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x90,
0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00,
0x0f, 0x00, 0x00, 0x00, 0xd8, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00,
0x00, 0x27, 0x00, 0x00, 0x00, 0x7b, 0x30, 0x46, 0x39, 0x36, 0x43,
0x44, 0x43, 0x30, 0x2d, 0x34, 0x43, 0x44, 0x46, 0x2d, 0x34, 0x33,
0x30, 0x34, 0x2d, 0x42, 0x32, 0x38, 0x33, 0x2d, 0x37, 0x42, 0x39,
0x32, 0x36, 0x34, 0x38, 0x38, 0x39, 0x45, 0x46, 0x37, 0x7d, 0x00,
0x00, 0x1e, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x7b, 0x39,
0x31, 0x33, 0x42, 0x38, 0x44, 0x31, 0x38, 0x2d, 0x46, 0x42, 0x42,
0x36, 0x2d, 0x34, 0x43, 0x41, 0x43, 0x2d, 0x41, 0x32, 0x33, 0x39,
0x2d, 0x43, 0x37, 0x34, 0x43, 0x31, 0x31, 0x45, 0x33, 0x46, 0x41,
0x37, 0x34, 0x7d, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x25, 0x00,
0x00, 0x00, 0x3a, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x6f,
0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x64, 0x3b, 0x3a, 0x23,
0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x6f, 0x75, 0x70, 0x67,
0x72, 0x61, 0x64, 0x65, 0x64, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00,
0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x50, 0x61, 0x74, 0x63, 0x68,
0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x00,
0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
}

Definition at line 405 of file patch.c.

◆ p_name0

const WCHAR p_name0[] = { 0x4840, 0x3b3f, 0x43f2, 0x4438, 0x45b1, 0 }
static

Definition at line 349 of file patch.c.

◆ p_name1

const WCHAR p_name1[] = { 0x4840, 0x3f7f, 0x4164, 0x422f, 0x4836, 0 }
static

Definition at line 350 of file patch.c.

◆ p_name2

const WCHAR p_name2[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0 }
static

Definition at line 351 of file patch.c.

◆ p_name3

const WCHAR p_name3[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0x482f, 0 }
static

Definition at line 352 of file patch.c.

◆ p_name4

const WCHAR p_name4[] = { 0x3a8c, 0x47cb, 0x45b0, 0x45ec, 0x45a8, 0x4837, 0}
static

Definition at line 353 of file patch.c.

◆ p_name5

const WCHAR p_name5[] = { 0x4840, 0x4596, 0x3e6c, 0x45e4, 0x42e6, 0x421c, 0x4634, 0x4468, 0x4226, 0 }
static

Definition at line 354 of file patch.c.

◆ p_name6

const WCHAR p_name6[]
static
Initial value:
= { 0x0005, 0x0053, 0x0075, 0x006d, 0x006d, 0x0061, 0x0072,
0x0079, 0x0049, 0x006e, 0x0066, 0x006f, 0x0072, 0x006d,
0x0061, 0x0074, 0x0069, 0x006f, 0x006e, 0 }

Definition at line 355 of file patch.c.

◆ p_name7

const WCHAR p_name7[]
static
Initial value:
= { 0x0074, 0x0061, 0x0072, 0x0067, 0x0065, 0x0074, 0x0054, 0x006f, 0x0075, 0x0070,
0x0067, 0x0072, 0x0061, 0x0064, 0x0065, 0x0064, 0 }

Definition at line 359 of file patch.c.

Referenced by create_patch().

◆ p_name8

const WCHAR p_name8[]
static
Initial value:
= { 0x0023, 0x0074, 0x0061, 0x0072, 0x0067, 0x0065, 0x0074, 0x0054, 0x006f, 0x0075,
0x0070, 0x0067, 0x0072, 0x0061, 0x0064, 0x0065, 0x0064, 0 }

Definition at line 361 of file patch.c.

Referenced by create_patch().

◆ PHANDLE

Definition at line 39 of file patch.c.

◆ PROG_FILES_DIR

char PROG_FILES_DIR[MAX_PATH]
static

Definition at line 49 of file patch.c.

Referenced by delete_pf(), get_pf_file_size(), and START_TEST().

◆ property_dat

const char property_dat[]
static
Initial value:
=
"Property\tValue\n"
"s72\tl0\n"
"Property\tProperty\n"
"Manufacturer\tWineHQ\n"
"ProductCode\t{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}\n"
"UpgradeCode\t{A2E3D643-4E2C-477F-A309-F76F552D5F43}\n"
"ProductLanguage\t1033\n"
"ProductName\tmsitest\n"
"ProductVersion\t1.1.1\n"
"PATCHNEWSUMMARYSUBJECT\tInstaller Database\n"
"MSIFASTINSTALL\t1\n"

Definition at line 54 of file patch.c.

◆ t1_data0

const WCHAR t1_data0[]
static
Initial value:
= {
0x0008, 0x0001, 0x03ea, 0x8000
}

Definition at line 458 of file patch.c.

◆ t1_data1

const char t1_data1[]
static
Initial value:
= {
"patch.txt"
}

Definition at line 461 of file patch.c.

◆ t1_data2

const WCHAR t1_data2[]
static
Initial value:
= {
0, 0,
9, 1,
}

Definition at line 464 of file patch.c.

◆ t1_data3

const char t1_data3[]
static

Definition at line 469 of file patch.c.

◆ t1_name0

const WCHAR t1_name0[] = { 0x4840, 0x430f, 0x422f, 0 }
static

Definition at line 451 of file patch.c.

◆ t1_name1

const WCHAR t1_name1[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0 }
static

Definition at line 452 of file patch.c.

◆ t1_name2

const WCHAR t1_name2[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0x482f, 0 }
static

Definition at line 453 of file patch.c.

◆ t1_name3

const WCHAR t1_name3[]
static
Initial value:
= { 0x0005, 0x0053, 0x0075, 0x006d, 0x006d, 0x0061, 0x0072,
0x0079, 0x0049, 0x006e, 0x0066, 0x006f, 0x0072, 0x006d,
0x0061, 0x0074, 0x0069, 0x006f, 0x006e, 0 }

Definition at line 454 of file patch.c.

◆ t2_data0

const WCHAR t2_data0[]
static
Initial value:
= {
0x00c0, 0x0001, 0x9000, 0x83e8
}

Definition at line 538 of file patch.c.

◆ t2_data1

const WCHAR t2_data1[]
static
Initial value:
= {
0x0601, 0x8002, 0x03e9, 0x8000, 0x0000, 0x0007, 0x0000, 0x0008
}

Definition at line 541 of file patch.c.

◆ t2_data2

const WCHAR t2_data2[]
static
Initial value:
= {
0x0401, 0x0009, 0x0000, 0x000a, 0xad48, 0x0401, 0x0009, 0x0000,
0x000b, 0xa502, 0x0401, 0x0009, 0x0000, 0x000c, 0x8104, 0x0401,
0x0009, 0x0000, 0x000d, 0x8502, 0x0401, 0x0009, 0x0000, 0x000e,
0x9900, 0x0401, 0x0009, 0x0000, 0x000f, 0x9d48, 0x0401, 0x0010,
0x0000, 0x0011, 0xad26, 0x0401, 0x0010, 0x0000, 0x0012, 0x8502,
0x0401, 0x0014, 0x0000, 0x0015, 0xad26, 0x0401, 0x0014, 0x0000,
0x000e, 0x8900
}

Definition at line 544 of file patch.c.

◆ t2_data3

const WCHAR t2_data3[]
static
Initial value:
= {
0x0101, 0x0009, 0x0101, 0x0010, 0x0101, 0x0014
}

Definition at line 553 of file patch.c.

◆ t2_data4

const WCHAR t2_data4[]
static
Initial value:
= {
0x0201, 0x0002, 0x0003, 0x0201, 0x0004, 0x0005
}

Definition at line 556 of file patch.c.

◆ t2_data5

const WCHAR t2_data5[]
static
Initial value:
= {
0x0201, 0x0013, 0x8002
}

Definition at line 559 of file patch.c.

◆ t2_data6

const WCHAR t2_data6[]
static
Initial value:
= {
0x0301, 0x0006, 0x0000, 0x87d1
}

Definition at line 562 of file patch.c.

◆ t2_data7

const char t2_data7[]
static
Initial value:
= {
"patch.txtPATCHNEWSUMMARYSUBJECTInstallation DatabasePATCHNEWPACKAGECODE{42A14A82-12F8-4E6D-970E-1B4EE7BE28B0}"
"PatchFiles#CAB_msitestpropPatchFile_SequencePatchSizeAttributesHeaderStreamRef_PatchPackagePatchIdMedia_"
"{0F96CDC0-4CDF-4304-B283-7B9264889EF7}MsiPatchHeadersStreamRef"
}

Definition at line 565 of file patch.c.

◆ t2_data8

const WCHAR t2_data8[]
static
Initial value:
= {
0, 0,
9, 1,
22, 1,
21, 1,
19, 1,
38, 1,
10, 1,
12, 1,
4, 1,
5, 7,
5, 1,
8, 1,
9, 1,
10, 1,
6, 2,
10, 1,
12, 3,
7, 1,
6, 1,
38, 1,
15, 3,
9, 1
}

Definition at line 570 of file patch.c.

◆ t2_data9

const char t2_data9[]
static

Definition at line 595 of file patch.c.

◆ t2_name0

const WCHAR t2_name0[] = { 0x4840, 0x430f, 0x422f, 0 }
static

Definition at line 524 of file patch.c.

◆ t2_name1

const WCHAR t2_name1[] = { 0x4840, 0x4216, 0x4327, 0x4824, 0 }
static

Definition at line 525 of file patch.c.

◆ t2_name2

const WCHAR t2_name2[] = { 0x4840, 0x3b3f, 0x43f2, 0x4438, 0x45b1, 0 }
static

Definition at line 526 of file patch.c.

◆ t2_name3

const WCHAR t2_name3[] = { 0x4840, 0x3f7f, 0x4164, 0x422f, 0x4836, 0 }
static

Definition at line 527 of file patch.c.

◆ t2_name4

const WCHAR t2_name4[] = { 0x4840, 0x4559, 0x44f2, 0x4568, 0x4737, 0 }
static

Definition at line 528 of file patch.c.

◆ t2_name5

const WCHAR t2_name5[] = { 0x4840, 0x4119, 0x41b7, 0x3e6b, 0x41a4, 0x412e, 0x422a, 0 }
static

Definition at line 529 of file patch.c.

◆ t2_name6

const WCHAR t2_name6[]
static
Initial value:
= { 0x4840, 0x4452, 0x45f6, 0x43e4, 0x3baf, 0x423b, 0x4626,
0x4237, 0x421c, 0x4634, 0x4468, 0x4226, 0 }

Definition at line 530 of file patch.c.

◆ t2_name7

const WCHAR t2_name7[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0 }
static

Definition at line 532 of file patch.c.

◆ t2_name8

const WCHAR t2_name8[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0x482f, 0 }
static

Definition at line 533 of file patch.c.

◆ t2_name9

const WCHAR t2_name9[]
static
Initial value:
= { 0x0005, 0x0053, 0x0075, 0x006d, 0x006d, 0x0061, 0x0072,
0x0079, 0x0049, 0x006e, 0x0066, 0x006f, 0x0072, 0x006d,
0x0061, 0x0074, 0x0069, 0x006f, 0x006e, 0 }

Definition at line 534 of file patch.c.

◆ table_patch_data

const struct table_data table_patch_data[]
static
Initial value:
= {
{ p_name0, p_data0, sizeof p_data0 },
{ p_name1, p_data1, sizeof p_data1 },
{ p_name2, p_data2, sizeof p_data2 - 1 },
{ p_name3, p_data3, sizeof p_data3 },
{ p_name4, p_data4, sizeof p_data4 },
{ p_name5, p_data5, sizeof p_data5 },
{ p_name6, p_data6, sizeof p_data6 }
}
static const WCHAR p_name0[]
Definition: patch.c:349
static const char p_data4[]
Definition: patch.c:386
static const WCHAR p_name5[]
Definition: patch.c:354
static const char p_data2[]
Definition: patch.c:372
static const WCHAR p_name1[]
Definition: patch.c:350
static const WCHAR p_data0[]
Definition: patch.c:365
static const WCHAR p_data3[]
Definition: patch.c:375
static const WCHAR p_name4[]
Definition: patch.c:353
static const WCHAR p_name6[]
Definition: patch.c:355
static const WCHAR p_data5[]
Definition: patch.c:402
static const char p_data6[]
Definition: patch.c:405
static const WCHAR p_name3[]
Definition: patch.c:352
static const WCHAR p_name2[]
Definition: patch.c:351
static const WCHAR p_data1[]
Definition: patch.c:369

Definition at line 439 of file patch.c.

Referenced by create_patch().

◆ table_transform1_data

const struct table_data table_transform1_data[]
static
Initial value:
= {
{ t1_name0, t1_data0, sizeof t1_data0 },
{ t1_name1, t1_data1, sizeof t1_data1 - 1 },
{ t1_name2, t1_data2, sizeof t1_data2 },
{ t1_name3, t1_data3, sizeof t1_data3 }
}
static const char t1_data3[]
Definition: patch.c:469
static const WCHAR t1_data0[]
Definition: patch.c:458
static const WCHAR t1_name3[]
Definition: patch.c:454
static const WCHAR t1_name1[]
Definition: patch.c:452
static const WCHAR t1_name0[]
Definition: patch.c:451
static const WCHAR t1_data2[]
Definition: patch.c:464
static const WCHAR t1_name2[]
Definition: patch.c:453
static const char t1_data1[]
Definition: patch.c:461

Definition at line 515 of file patch.c.

Referenced by create_patch().

◆ table_transform2_data

const struct table_data table_transform2_data[]
static
Initial value:
= {
{ t2_name0, t2_data0, sizeof t2_data0 },
{ t2_name1, t2_data1, sizeof t2_data1 },
{ t2_name2, t2_data2, sizeof t2_data2 },
{ t2_name3, t2_data3, sizeof t2_data3 },
{ t2_name4, t2_data4, sizeof t2_data4 },
{ t2_name5, t2_data5, sizeof t2_data5 },
{ t2_name6, t2_data6, sizeof t2_data6 },
{ t2_name7, t2_data7, sizeof t2_data7 - 1 },
{ t2_name8, t2_data8, sizeof t2_data8 },
{ t2_name9, t2_data9, sizeof t2_data9 }
}
static const WCHAR t2_name5[]
Definition: patch.c:529
static const WCHAR t2_data2[]
Definition: patch.c:544
static const WCHAR t2_data1[]
Definition: patch.c:541
static const WCHAR t2_data4[]
Definition: patch.c:556
static const WCHAR t2_data8[]
Definition: patch.c:570
static const WCHAR t2_data6[]
Definition: patch.c:562
static const WCHAR t2_name0[]
Definition: patch.c:524
static const char t2_data9[]
Definition: patch.c:595
static const WCHAR t2_name6[]
Definition: patch.c:530
static const char t2_data7[]
Definition: patch.c:565
static const WCHAR t2_name3[]
Definition: patch.c:527
static const WCHAR t2_name8[]
Definition: patch.c:533
static const WCHAR t2_name1[]
Definition: patch.c:525
static const WCHAR t2_name9[]
Definition: patch.c:534
static const WCHAR t2_name4[]
Definition: patch.c:528
static const WCHAR t2_name2[]
Definition: patch.c:526
static const WCHAR t2_data3[]
Definition: patch.c:553
static const WCHAR t2_data5[]
Definition: patch.c:559
static const WCHAR t2_name7[]
Definition: patch.c:532
static const WCHAR t2_data0[]
Definition: patch.c:538

Definition at line 634 of file patch.c.

Referenced by create_patch().

◆ tables

const struct msi_table tables[]
static
Initial value:
=
{
ADD_TABLE( component ),
ADD_TABLE( feature_comp ),
ADD_TABLE( install_exec_seq ),
}
INTERNETFEATURELIST feature
Definition: misc.c:1719
#define ADD_TABLE(x)
Definition: patch.c:131
Definition: fci.c:126

Definition at line 133 of file patch.c.

Referenced by create_database(), test_MsiOpenDatabase(), test_patch_registration(), test_simple_patch(), test_system_tables(), and write_tables().