ReactOS  0.4.14-dev-115-g4576127
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 #include "wine/unicode.h"
28 
29 #include "errorrep.h"
30 
32 
33 static const WCHAR SZ_EXCLUSIONLIST_KEY[] = {
34  'S','o','f','t','w','a','r','e','\\',
35  'M','i','c','r','o','s','o','f','t','\\',
36  'P','C','H','e','a','l','t','h','\\',
37  'E','r','r','o','r','R','e','p','o','r','t','i','n','g','\\',
38  'E','x','c','l','u','s','i','o','n','L','i','s','t', 0};
39 
40 /*************************************************************************
41  * AddERExcludedApplicationW [FAULTREP.@]
42  *
43  * Adds an application to a list of applications for which fault reports
44  * shouldn't be generated
45  *
46  * PARAMS
47  * lpAppFileName [I] The filename of the application executable
48  *
49  * RETURNS
50  * TRUE on success, FALSE of failure
51  *
52  * NOTES
53  * Wine doesn't use this data but stores it in the registry (in the same place
54  * as Windows would) in case it will be useful in a future version
55  *
56  */
58 {
59  WCHAR *bslash;
60  DWORD value = 1;
61  HKEY hkey;
62  LONG res;
63 
64  TRACE("(%s)\n", wine_dbgstr_w(lpAppFileName));
65  bslash = strrchrW(lpAppFileName, '\\');
66  if (bslash != NULL)
67  lpAppFileName = bslash + 1;
68  if (*lpAppFileName == '\0')
69  {
71  return FALSE;
72  }
73 
75  if (!res)
76  {
77  RegSetValueExW(hkey, lpAppFileName, 0, REG_DWORD, (LPBYTE)&value, sizeof(value));
78  RegCloseKey(hkey);
79  }
80 
81  return !res;
82 }
83 
84 /*************************************************************************
85  * AddERExcludedApplicationA [FAULTREP.@]
86  *
87  * See AddERExcludedApplicationW
88  */
90 {
91  int len = MultiByteToWideChar(CP_ACP, 0, lpAppFileName, -1, NULL, 0);
92  WCHAR *wstr;
93  BOOL ret;
94 
95  TRACE("(%s)\n", wine_dbgstr_a(lpAppFileName));
96  if (len == 0)
97  return FALSE;
98  wstr = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*len);
99  MultiByteToWideChar(CP_ACP, 0, lpAppFileName, -1, wstr, len);
101  HeapFree(GetProcessHeap(), 0, wstr);
102  return ret;
103 }
104 
105 /*************************************************************************
106  * ReportFault [FAULTREP.@]
107  */
108 EFaultRepRetVal WINAPI ReportFault(LPEXCEPTION_POINTERS pep, DWORD dwOpt)
109 {
110  FIXME("%p 0x%x stub\n", pep, dwOpt);
111  return frrvOk;
112 }
113 
114 /***********************************************************************
115  * DllMain.
116  */
118 {
119  switch(reason)
120  {
121  case DLL_WINE_PREATTACH:
122  return FALSE;
123  case DLL_PROCESS_ATTACH:
125  break;
126  }
127  return TRUE;
128 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
EFaultRepRetVal WINAPI ReportFault(LPEXCEPTION_POINTERS pep, DWORD dwOpt)
Definition: faultrep.c:108
#define TRUE
Definition: types.h:120
const char int int int static __inline const char * wine_dbgstr_a(const char *s)
Definition: debug.h:186
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define CP_ACP
Definition: compat.h:99
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
Definition: faultrep.c:117
static const WCHAR SZ_EXCLUSIONLIST_KEY[]
Definition: faultrep.c:33
#define FIXME(fmt,...)
Definition: debug.h:110
r reserved
Definition: btrfs.c:2893
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
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:4895
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WINAPI
Definition: msvc.h:8
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
BOOL WINAPI AddERExcludedApplicationW(LPCWSTR lpAppFileName)
Definition: faultrep.c:57
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
int ret
BOOL WINAPI AddERExcludedApplicationA(LPCSTR lpAppFileName)
Definition: faultrep.c:89
GLenum GLsizei len
Definition: glext.h:6722
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
WINE_UNICODE_INLINE WCHAR * strrchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:254
#define MultiByteToWideChar
Definition: compat.h:100
GLuint res
Definition: glext.h:9613
#define REG_DWORD
Definition: sdbapi.c:596
#define HeapFree(x, y, z)
Definition: compat.h:394
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
WINE_DEFAULT_DEBUG_CHANNEL(faultrep)