ReactOS 0.4.17-dev-812-ged4f258
faultrep.c
Go to the documentation of this file.
1/*
2 * Unit test suite for fault reporting in XP and above
3 *
4 * Copyright 2010 Detlef Riekenberg
5 *
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.
10 *
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.
15 *
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
19 *
20 */
21
22#include <stdarg.h>
23#include <stdio.h>
24
25#include "windef.h"
26#include "winbase.h"
27#include "winerror.h"
28#include "winreg.h"
29
30#include "errorrep.h"
31#include "wine/test.h"
32
33static const char regpath_root[] = "Software\\Microsoft\\PCHealth\\ErrorReporting";
34static const char regpath_exclude[] = "ExclusionList";
35
36
38{
41 DWORD size;
42
46
48}
49
51{
54 DWORD size;
55
59
60 return enabled;
61}
62
63
64/* ###### */
65
67{
68 BOOL res;
69 LONG lres;
70 HKEY hroot;
71 HKEY hexclude = 0;
72
73 /* clean state */
75
76 if (!lres)
77 lres = RegOpenKeyA(hroot, regpath_exclude, &hexclude);
78
79 if (!lres)
80 RegDeleteValueA(hexclude, "winetest_faultrep.exe");
81
82
83 SetLastError(0xdeadbeef);
85 ok(!res, "got %d and 0x%lx (expected FALSE)\n", res, GetLastError());
86
87 SetLastError(0xdeadbeef);
89 ok(!res, "got %d and 0x%lx (expected FALSE)\n", res, GetLastError());
90
91 SetLastError(0xdeadbeef);
92 /* existence of the path doesn't matter this function succeeded */
93 res = AddERExcludedApplicationA("winetest_faultrep.exe");
95 {
96 /* LastError is not set! */
98 "AddERExcludedApplicationA should have failed, got %d\n", res);
99 }
100 else
101 {
102 ok(res, "AddERExcludedApplicationA failed (le=0x%lx)\n", GetLastError());
103
104 /* add, when already present */
105 SetLastError(0xdeadbeef);
106 res = AddERExcludedApplicationA("winetest_faultrep.exe");
107 ok(res, "AddERExcludedApplicationA failed (le=0x%lx)\n", GetLastError());
108 }
109
110 /* cleanup */
111 RegDeleteValueA(hexclude, "winetest_faultrep.exe");
112
113 RegCloseKey(hexclude);
114 RegCloseKey(hroot);
115}
116
117/* ########################### */
118
119START_TEST(faultrep)
120{
122}
#define ok(value,...)
Definition: atltest.h:57
#define broken(x)
Definition: atltest.h:178
#define START_TEST(x)
Definition: atltest.h:75
#define RegCloseKey(hKey)
Definition: registry.h:49
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
LONG WINAPI RegCreateKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1179
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3234
LONG WINAPI RegDeleteValueA(HKEY hKey, LPCSTR lpValueName)
Definition: reg.c:2287
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:411
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:294
#define CloseHandle
Definition: compat.h:739
#define SetLastError(x)
Definition: compat.h:752
#define GetCurrentProcess()
Definition: compat.h:759
BOOL WINAPI AddERExcludedApplicationA(LPCSTR lpAppFileName)
Definition: faultrep.c:82
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glext.h:7750
GLuint res
Definition: glext.h:9613
GLsizeiptr size
Definition: glext.h:5919
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
static const char regpath_root[]
Definition: faultrep.c:33
static BOOL is_registry_virtualization_enabled(void)
Definition: faultrep.c:50
static BOOL is_process_limited(void)
Definition: faultrep.c:37
static void test_AddERExcludedApplicationA(void)
Definition: faultrep.c:66
static const char regpath_exclude[]
Definition: faultrep.c:34
long LONG
Definition: pedump.c:60
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
enum _TOKEN_ELEVATION_TYPE TOKEN_ELEVATION_TYPE
@ TokenElevationTypeLimited
Definition: winnt_old.h:2719
@ TokenElevationTypeDefault
Definition: winnt_old.h:2717
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define TOKEN_QUERY
Definition: setypes.h:940
@ TokenVirtualizationEnabled
Definition: setypes.h:1001
@ TokenElevationType
Definition: setypes.h:995