Update the address of the Free Software Foundation.
[wine/gsoc_dplay.git] / dlls / msi / tests / msi.c
blobff15af4d774bcf7e5e4d90830d97d05c4466d8b9
1 /*
2 * tests for Microsoft Installer functionality
4 * Copyright 2005 Mike McCormack for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdio.h>
22 #include <windows.h>
23 #include <msi.h>
24 #include <msiquery.h>
26 #include "wine/test.h"
28 typedef INSTALLSTATE (WINAPI *fnMsiUseFeatureExA)(LPCSTR, LPCSTR ,DWORD, DWORD );
29 fnMsiUseFeatureExA pMsiUseFeatureExA;
31 static void test_usefeature(void)
33 UINT r;
35 if (!pMsiUseFeatureExA)
36 return;
38 r = MsiQueryFeatureState(NULL,NULL);
39 ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
41 r = MsiQueryFeatureState("{9085040-6000-11d3-8cfe-0150048383c9}" ,NULL);
42 ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
44 r = MsiUseFeatureExA(NULL,NULL,0,0);
45 ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
47 r = MsiUseFeatureExA(NULL,
48 "WORDVIEWFiles", -2, 1 );
49 ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
51 r = MsiUseFeatureExA("{90850409-6000-11d3-8cfe-0150048383c9}",
52 NULL, -2, 0 );
53 ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
55 r = MsiUseFeatureExA("{9085040-6000-11d3-8cfe-0150048383c9}",
56 "WORDVIEWFiles", -2, 0 );
57 ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
59 r = MsiUseFeatureExA("{0085040-6000-11d3-8cfe-0150048383c9}",
60 "WORDVIEWFiles", -2, 0 );
61 ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
63 r = MsiUseFeatureExA("{90850409-6000-11d3-8cfe-0150048383c9}",
64 "WORDVIEWFiles", -2, 1 );
65 ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
69 static void test_null(void)
71 MSIHANDLE hpkg;
72 UINT r;
74 r = MsiOpenPackageExW(NULL, 0, &hpkg);
75 ok( r == ERROR_INVALID_PARAMETER,"wrong error\n");
77 r = MsiQueryProductStateW(NULL);
78 ok( r == INSTALLSTATE_INVALIDARG, "wrong return\n");
80 r = MsiEnumFeaturesW(NULL,0,NULL,NULL);
81 ok( r == ERROR_INVALID_PARAMETER,"wrong error\n");
84 START_TEST(msi)
86 HMODULE hmod = GetModuleHandle("msi.dll");
87 pMsiUseFeatureExA = (fnMsiUseFeatureExA)
88 GetProcAddress(hmod, "MsiUseFeatureExA");
90 test_usefeature();
91 test_null();