makefiles: Don't use standard libs for programs that specify -nodefaultlibs.
[wine/zf.git] / dlls / faultrep / faultrep.c
blob3191659cd6c98e06ed567c48dd4992d8c582c0b8
1 /* Fault report handling
3 * Copyright 2007 Peter Dons Tychsen
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.
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.
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
20 #include <stdarg.h>
22 #include "windef.h"
23 #include "winbase.h"
24 #include "winnls.h"
25 #include "winreg.h"
26 #include "wine/debug.h"
28 #include "errorrep.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(faultrep);
32 static 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};
39 /*************************************************************************
40 * AddERExcludedApplicationW [FAULTREP.@]
42 * Adds an application to a list of applications for which fault reports
43 * shouldn't be generated
45 * PARAMS
46 * lpAppFileName [I] The filename of the application executable
48 * RETURNS
49 * TRUE on success, FALSE of failure
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
56 BOOL WINAPI AddERExcludedApplicationW(LPCWSTR lpAppFileName)
58 WCHAR *bslash;
59 DWORD value = 1;
60 HKEY hkey;
61 LONG res;
63 TRACE("(%s)\n", wine_dbgstr_w(lpAppFileName));
64 bslash = wcsrchr(lpAppFileName, '\\');
65 if (bslash != NULL)
66 lpAppFileName = bslash + 1;
67 if (*lpAppFileName == '\0')
69 SetLastError(ERROR_INVALID_PARAMETER);
70 return FALSE;
73 res = RegCreateKeyW(HKEY_LOCAL_MACHINE, SZ_EXCLUSIONLIST_KEY, &hkey);
74 if (!res)
76 RegSetValueExW(hkey, lpAppFileName, 0, REG_DWORD, (LPBYTE)&value, sizeof(value));
77 RegCloseKey(hkey);
80 return !res;
83 /*************************************************************************
84 * AddERExcludedApplicationA [FAULTREP.@]
86 * See AddERExcludedApplicationW
88 BOOL WINAPI AddERExcludedApplicationA(LPCSTR lpAppFileName)
90 int len = MultiByteToWideChar(CP_ACP, 0, lpAppFileName, -1, NULL, 0);
91 WCHAR *wstr;
92 BOOL ret;
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);
99 ret = AddERExcludedApplicationW(wstr);
100 HeapFree(GetProcessHeap(), 0, wstr);
101 return ret;
104 /*************************************************************************
105 * ReportFault [FAULTREP.@]
107 EFaultRepRetVal WINAPI ReportFault(LPEXCEPTION_POINTERS pep, DWORD dwOpt)
109 FIXME("%p 0x%x stub\n", pep, dwOpt);
110 return frrvOk;
113 /***********************************************************************
114 * DllMain.
116 BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
118 switch(reason)
120 case DLL_WINE_PREATTACH:
121 return FALSE;
122 case DLL_PROCESS_ATTACH:
123 DisableThreadLibraryCalls(inst);
124 break;
126 return TRUE;