Release 1.6-rc2.
[wine/testsucceed.git] / dlls / faultrep / tests / faultrep.c
blobdd52928fe38f8dbe2d03e04fe9450766eab52072
1 /*
2 * Unit test suite for fault reporting in XP and above
4 * Copyright 2010 Detlef Riekenberg
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
22 #include <stdarg.h>
23 #include <stdio.h>
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winerror.h"
28 #include "winreg.h"
30 #include "errorrep.h"
31 #include "wine/test.h"
33 static char regpath_root[] = "Software\\Microsoft\\PCHealth\\ErrorReporting";
34 static char regpath_exclude[] = "ExclusionList";
36 /* ###### */
38 static void test_AddERExcludedApplicationA(void)
40 BOOL res;
41 LONG lres;
42 HKEY hroot;
43 HKEY hexclude = 0;
45 /* clean state */
46 lres = RegOpenKeyExA(HKEY_LOCAL_MACHINE, regpath_root, 0, KEY_WRITE, &hroot);
48 if (!lres)
49 lres = RegOpenKeyA(hroot, regpath_exclude, &hexclude);
51 if (!lres)
52 RegDeleteValueA(hexclude, "winetest_faultrep.exe");
55 SetLastError(0xdeadbeef);
56 res = AddERExcludedApplicationA(NULL);
57 ok(!res, "got %d and 0x%x (expected FALSE)\n", res, GetLastError());
59 SetLastError(0xdeadbeef);
60 res = AddERExcludedApplicationA("");
61 ok(!res, "got %d and 0x%x (expected FALSE)\n", res, GetLastError());
63 SetLastError(0xdeadbeef);
64 /* access rights to HKLM or existence of the path doesn't matter
65 this function succeeded */
66 res = AddERExcludedApplicationA("winetest_faultrep.exe");
67 ok(res, "got %d and 0x%x (expected TRUE)\n", res, GetLastError());
69 /* add, when already present */
70 SetLastError(0xdeadbeef);
71 res = AddERExcludedApplicationA("winetest_faultrep.exe");
72 ok(res, "got %d and 0x%x (expected TRUE)\n", res, GetLastError());
74 /* cleanup */
75 RegDeleteValueA(hexclude, "winetest_faultrep.exe");
77 RegCloseKey(hexclude);
78 RegCloseKey(hroot);
81 /* ########################### */
83 START_TEST(faultrep)
85 test_AddERExcludedApplicationA();