ReactOS  0.4.14-dev-583-g2a1ba2c
custom.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include <windef.h>
#include <winbase.h>
#include <objbase.h>
#include <unknwn.h>
#include <msi.h>
#include <msiquery.h>
Include dependency graph for custom.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 
#define ok(hinst, condition, ...)   ok_(hinst, 0, __FILE__, __LINE__, condition, __VA_ARGS__)
 
#define todo_wine_ok(hinst, condition, ...)   ok_(hinst, 1, __FILE__, __LINE__, condition, __VA_ARGS__)
 

Functions

static void ok_ (MSIHANDLE hinst, int todo, const char *file, int line, int condition, const char *msg,...)
 
UINT WINAPI main_test (MSIHANDLE hinst)
 
UINT WINAPI test_retval (MSIHANDLE hinst)
 
static void append_file (MSIHANDLE hinst, const char *filename, const char *text)
 
UINT WINAPI da_immediate (MSIHANDLE hinst)
 
UINT WINAPI da_deferred (MSIHANDLE hinst)
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 26 of file custom.c.

◆ ok

#define ok (   hinst,
  condition,
  ... 
)    ok_(hinst, 0, __FILE__, __LINE__, condition, __VA_ARGS__)

Definition at line 51 of file custom.c.

◆ todo_wine_ok

#define todo_wine_ok (   hinst,
  condition,
  ... 
)    ok_(hinst, 1, __FILE__, __LINE__, condition, __VA_ARGS__)

Definition at line 52 of file custom.c.

Function Documentation

◆ append_file()

static void append_file ( MSIHANDLE  hinst,
const char filename,
const char text 
)
static

Definition at line 87 of file custom.c.

88 {
89  DWORD size;
91  ok(hinst, file != INVALID_HANDLE_VALUE, "CreateFile failed, error %u\n", GetLastError());
92 
96 }
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
const WCHAR * text
Definition: package.c:1827
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
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
#define OPEN_EXISTING
Definition: compat.h:434
GLsizeiptr size
Definition: glext.h:5919
#define FILE_END
Definition: winbase.h:114
#define ok(hinst, condition,...)
Definition: custom.c:51
unsigned long DWORD
Definition: ntddk_ex.h:95
static HINSTANCE hinst
Definition: edit.c:551
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:407
Definition: fci.c:126

Referenced by da_deferred(), and da_immediate().

◆ da_deferred()

UINT WINAPI da_deferred ( MSIHANDLE  hinst)

Definition at line 114 of file custom.c.

115 {
116  char prop[300];
117  DWORD len = sizeof(prop);
118  LANGID lang;
119  UINT r;
120 
121  /* Test that we were in fact deferred */
122  r = MsiGetPropertyA(hinst, "CustomActionData", prop, &len);
123  ok(hinst, r == ERROR_SUCCESS, "got %u\n", r);
124  ok(hinst, prop[0], "CustomActionData was empty\n");
125 
126  append_file(hinst, prop, "two");
127 
128  /* Test available properties */
129  len = sizeof(prop);
130  r = MsiGetPropertyA(hinst, "ProductCode", prop, &len);
131  ok(hinst, r == ERROR_SUCCESS, "got %u\n", r);
132  ok(hinst, prop[0], "got %s\n", prop);
133 
134  len = sizeof(prop);
135  r = MsiGetPropertyA(hinst, "UserSID", prop, &len);
136  ok(hinst, r == ERROR_SUCCESS, "got %u\n", r);
137  ok(hinst, prop[0], "got %s\n", prop);
138 
139  len = sizeof(prop);
140  r = MsiGetPropertyA(hinst, "TESTPATH", prop, &len);
141  ok(hinst, r == ERROR_SUCCESS, "got %u\n", r);
142  todo_wine_ok(hinst, !prop[0], "got %s\n", prop);
143 
144  /* Test modes */
145  ok(hinst, MsiGetMode(hinst, MSIRUNMODE_SCHEDULED), "should be scheduled\n");
146  ok(hinst, !MsiGetMode(hinst, MSIRUNMODE_ROLLBACK), "shouldn't be rollback\n");
147  ok(hinst, !MsiGetMode(hinst, MSIRUNMODE_COMMIT), "shouldn't be commit\n");
148 
150  ok(hinst, lang != ERROR_INVALID_HANDLE, "MsiGetLanguage failed\n");
151 
152  return ERROR_SUCCESS;
153 }
static void append_file(MSIHANDLE hinst, const char *filename, const char *text)
Definition: custom.c:87
UINT WINAPI MsiGetPropertyA(MSIHANDLE hInstall, LPCSTR szName, LPSTR szValueBuf, LPDWORD pchValueBuf)
Definition: package.c:2488
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
WORD LANGID
Definition: typedefs.h:79
BOOL WINAPI MsiGetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode)
Definition: install.c:690
static const WCHAR lang[]
Definition: wbemdisp.c:287
#define todo_wine_ok(hinst, condition,...)
Definition: custom.c:52
#define ok(hinst, condition,...)
Definition: custom.c:51
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
unsigned int UINT
Definition: ndis.h:50
LANGID WINAPI MsiGetLanguage(MSIHANDLE hInstall)
Definition: install.c:1615
static HINSTANCE hinst
Definition: edit.c:551

◆ da_immediate()

UINT WINAPI da_immediate ( MSIHANDLE  hinst)

Definition at line 98 of file custom.c.

99 {
100  char prop[300];
101  DWORD len = sizeof(prop);
102 
103  MsiGetPropertyA(hinst, "TESTPATH", prop, &len);
104 
105  append_file(hinst, prop, "one");
106 
107  ok(hinst, !MsiGetMode(hinst, MSIRUNMODE_SCHEDULED), "shouldn't be scheduled\n");
108  ok(hinst, !MsiGetMode(hinst, MSIRUNMODE_ROLLBACK), "shouldn't be rollback\n");
109  ok(hinst, !MsiGetMode(hinst, MSIRUNMODE_COMMIT), "shouldn't be commit\n");
110 
111  return ERROR_SUCCESS;
112 }
static void append_file(MSIHANDLE hinst, const char *filename, const char *text)
Definition: custom.c:87
UINT WINAPI MsiGetPropertyA(MSIHANDLE hInstall, LPCSTR szName, LPSTR szValueBuf, LPDWORD pchValueBuf)
Definition: package.c:2488
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL WINAPI MsiGetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode)
Definition: install.c:690
#define ok(hinst, condition,...)
Definition: custom.c:51
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
static HINSTANCE hinst
Definition: edit.c:551

◆ main_test()

UINT WINAPI main_test ( MSIHANDLE  hinst)

Definition at line 57 of file custom.c.

58 {
59  UINT res;
60  IUnknown *unk = NULL;
61  HRESULT hres;
62 
63  /* Test for an MTA apartment */
64  hres = CoCreateInstance(&CLSID_Picture_Metafile, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
65  todo_wine_ok(hinst, hres == S_OK, "CoCreateInstance failed with %08x\n", hres);
66 
67  if (unk) IUnknown_Release(unk);
68 
69  /* Test MsiGetDatabaseState() */
71  todo_wine_ok(hinst, res == MSIDBSTATE_ERROR, "expected MSIDBSTATE_ERROR, got %u\n", res);
72 
73  return ERROR_SUCCESS;
74 }
#define ERROR_SUCCESS
Definition: deptool.c:10
smooth NULL
Definition: ftsmooth.c:416
MSIDBSTATE WINAPI MsiGetDatabaseState(MSIHANDLE handle)
Definition: database.c:2001
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
#define todo_wine_ok(hinst, condition,...)
Definition: custom.c:52
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define S_OK
Definition: intsafe.h:59
const CLSID CLSID_Picture_Metafile
unsigned int UINT
Definition: ndis.h:50
GLuint res
Definition: glext.h:9613
static HINSTANCE hinst
Definition: edit.c:551

◆ ok_()

static void ok_ ( MSIHANDLE  hinst,
int  todo,
const char file,
int  line,
int  condition,
const char msg,
  ... 
)
static

Definition at line 32 of file custom.c.

33 {
34  static char buffer[2000];
37 
40  va_end(valist);
41 
50 }
MSIHANDLE WINAPI MsiCreateRecord(UINT cParams)
Definition: record.c:95
UINT WINAPI MsiRecordSetStringA(MSIHANDLE handle, UINT iField, LPCSTR szValue)
Definition: record.c:601
UINT WINAPI MsiRecordSetInteger(MSIHANDLE handle, UINT iField, int iVal)
Definition: record.c:351
BOOL todo
Definition: filedlg.c:313
GLuint buffer
Definition: glext.h:5915
unsigned long MSIHANDLE
Definition: msiserver.idl:25
#define va_end(ap)
Definition: acmsvcex.h:90
GLenum condition
Definition: glext.h:9255
Definition: parser.c:48
char * va_list
Definition: acmsvcex.h:78
INT WINAPI MsiProcessMessage(MSIHANDLE hInstall, INSTALLMESSAGE eMessageType, MSIHANDLE hRecord)
Definition: package.c:2052
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:270
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
Definition: sprintf.c:733
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define msg(x)
Definition: auth_time.c:54
static HINSTANCE hinst
Definition: edit.c:551
static __ms_va_list valist
Definition: printf.c:64
Definition: fci.c:126

◆ test_retval()

UINT WINAPI test_retval ( MSIHANDLE  hinst)

Definition at line 76 of file custom.c.

77 {
78  char prop[10];
79  DWORD len = sizeof(prop);
80  UINT retval;
81 
82  MsiGetPropertyA(hinst, "TEST_RETVAL", prop, &len);
83  sscanf(prop, "%u", &retval);
84  return retval;
85 }
UINT WINAPI MsiGetPropertyA(MSIHANDLE hInstall, LPCSTR szName, LPSTR szValueBuf, LPDWORD pchValueBuf)
Definition: package.c:2488
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
unsigned int UINT
Definition: ndis.h:50
static HINSTANCE hinst
Definition: edit.c:551