ReactOS 0.4.16-dev-303-g11d5cb8
faultrep.c
Go to the documentation of this file.
1/* Fault report handling
2 *
3 * Copyright 2007 Peter Dons Tychsen
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 */
19
20#include <stdarg.h>
21
22#include "windef.h"
23#include "winbase.h"
24#include "winnls.h"
25#include "winreg.h"
26#include "wine/debug.h"
27
28#include "errorrep.h"
29
31
32static const WCHAR SZ_EXCLUSIONLIST_KEY[] = {
33 'S','o','f','t','w','a','r','e','\\',
34 'M','i','c','r','o','s','o','f','t','\\',
35 'P','C','H','e','a','l','t','h','\\',
36 'E','r','r','o','r','R','e','p','o','r','t','i','n','g','\\',
37 'E','x','c','l','u','s','i','o','n','L','i','s','t', 0};
38
39/*************************************************************************
40 * AddERExcludedApplicationW [FAULTREP.@]
41 *
42 * Adds an application to a list of applications for which fault reports
43 * shouldn't be generated
44 *
45 * PARAMS
46 * lpAppFileName [I] The filename of the application executable
47 *
48 * RETURNS
49 * TRUE on success, FALSE of failure
50 *
51 * NOTES
52 * Wine doesn't use this data but stores it in the registry (in the same place
53 * as Windows would) in case it will be useful in a future version
54 *
55 */
57{
58 WCHAR *bslash;
59 DWORD value = 1;
60 HKEY hkey;
61 LONG res;
62
63 TRACE("(%s)\n", wine_dbgstr_w(lpAppFileName));
64 bslash = wcsrchr(lpAppFileName, '\\');
65 if (bslash != NULL)
66 lpAppFileName = bslash + 1;
67 if (*lpAppFileName == '\0')
68 {
70 return FALSE;
71 }
72
74 if (!res)
75 {
76 RegSetValueExW(hkey, lpAppFileName, 0, REG_DWORD, (LPBYTE)&value, sizeof(value));
77 RegCloseKey(hkey);
78 }
79
80 return !res;
81}
82
83/*************************************************************************
84 * AddERExcludedApplicationA [FAULTREP.@]
85 *
86 * See AddERExcludedApplicationW
87 */
89{
90 int len = MultiByteToWideChar(CP_ACP, 0, lpAppFileName, -1, NULL, 0);
91 WCHAR *wstr;
92 BOOL ret;
93
94 TRACE("(%s)\n", wine_dbgstr_a(lpAppFileName));
95 if (len == 0)
96 return FALSE;
97 wstr = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*len);
98 MultiByteToWideChar(CP_ACP, 0, lpAppFileName, -1, wstr, len);
100 HeapFree(GetProcessHeap(), 0, wstr);
101 return ret;
102}
103
104/*************************************************************************
105 * ReportFault [FAULTREP.@]
106 */
107EFaultRepRetVal WINAPI ReportFault(LPEXCEPTION_POINTERS pep, DWORD dwOpt)
108{
109 FIXME("%p 0x%x stub\n", pep, dwOpt);
110 return frrvOk;
111}
112
113/***********************************************************************
114 * DllMain.
115 */
117{
118 switch(reason)
119 {
120 case DLL_WINE_PREATTACH:
121 return FALSE;
124 break;
125 }
126 return TRUE;
127}
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define FIXME(fmt,...)
Definition: precomp.h:53
#define RegCloseKey(hKey)
Definition: registry.h:49
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1201
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
#define GetProcessHeap()
Definition: compat.h:736
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define wcsrchr
Definition: compat.h:16
#define CP_ACP
Definition: compat.h:109
#define SetLastError(x)
Definition: compat.h:752
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define MultiByteToWideChar
Definition: compat.h:110
BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
Definition: faultrep.c:116
static const WCHAR SZ_EXCLUSIONLIST_KEY[]
Definition: faultrep.c:32
EFaultRepRetVal WINAPI ReportFault(LPEXCEPTION_POINTERS pep, DWORD dwOpt)
Definition: faultrep.c:107
BOOL WINAPI AddERExcludedApplicationA(LPCSTR lpAppFileName)
Definition: faultrep.c:88
BOOL WINAPI AddERExcludedApplicationW(LPCWSTR lpAppFileName)
Definition: faultrep.c:56
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
r reserved
Definition: btrfs.c:3006
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint res
Definition: glext.h:9613
GLenum GLsizei len
Definition: glext.h:6722
#define wine_dbgstr_w
Definition: kernel32.h:34
long LONG
Definition: pedump.c:60
#define REG_DWORD
Definition: sdbapi.c:596
const char int int int static __inline const char * wine_dbgstr_a(const char *s)
Definition: debug.h:187
#define TRACE(s)
Definition: solgame.cpp:4
unsigned char * LPBYTE
Definition: typedefs.h:53
Definition: pdh_main.c:94
int ret
#define WINAPI
Definition: msvc.h:6
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
const char * LPCSTR
Definition: xmlstorage.h:183
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185