2007-07-27 01:43:49 +02:00
|
|
|
/* Fault report handling
|
|
|
|
*
|
|
|
|
* Copyright 2007 Peter Dons Tychsen
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
2007-09-01 03:10:13 +02:00
|
|
|
#include "winnls.h"
|
|
|
|
#include "winreg.h"
|
2007-07-27 01:43:49 +02:00
|
|
|
#include "wine/debug.h"
|
2007-09-01 03:10:13 +02:00
|
|
|
|
|
|
|
#include "errorrep.h"
|
2007-07-27 01:43:49 +02:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(faultrep);
|
|
|
|
|
2007-09-01 03:10:13 +02:00
|
|
|
/*************************************************************************
|
|
|
|
* AddERExcludedApplicationW [FAULTREP.@]
|
|
|
|
*
|
|
|
|
* Adds an application to a list of applications for which fault reports
|
2008-04-02 22:10:47 +02:00
|
|
|
* shouldn't be generated
|
2007-09-01 03:10:13 +02:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* lpAppFileName [I] The filename of the application executable
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success, FALSE of failure
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* Wine doesn't use this data but stores it in the registry (in the same place
|
|
|
|
* as Windows would) in case it will be useful in a future version
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
BOOL WINAPI AddERExcludedApplicationW(LPCWSTR lpAppFileName)
|
|
|
|
{
|
|
|
|
WCHAR *bslash;
|
|
|
|
DWORD value = 1;
|
|
|
|
HKEY hkey;
|
2013-08-02 06:01:59 +02:00
|
|
|
LONG res;
|
2007-09-01 03:10:13 +02:00
|
|
|
|
|
|
|
TRACE("(%s)\n", wine_dbgstr_w(lpAppFileName));
|
2019-06-04 09:08:42 +02:00
|
|
|
bslash = wcsrchr(lpAppFileName, '\\');
|
2007-09-01 03:10:13 +02:00
|
|
|
if (bslash != NULL)
|
|
|
|
lpAppFileName = bslash + 1;
|
|
|
|
if (*lpAppFileName == '\0')
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2020-09-30 23:14:55 +02:00
|
|
|
res = RegCreateKeyW(HKEY_LOCAL_MACHINE,
|
|
|
|
L"Software\\Microsoft\\PCHealth\\ErrorReporting\\ExclusionList", &hkey);
|
2013-08-02 06:01:59 +02:00
|
|
|
if (!res)
|
2007-09-01 03:10:13 +02:00
|
|
|
{
|
|
|
|
RegSetValueExW(hkey, lpAppFileName, 0, REG_DWORD, (LPBYTE)&value, sizeof(value));
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
}
|
|
|
|
|
2013-08-02 06:01:59 +02:00
|
|
|
return !res;
|
2007-09-01 03:10:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* AddERExcludedApplicationA [FAULTREP.@]
|
|
|
|
*
|
|
|
|
* See AddERExcludedApplicationW
|
|
|
|
*/
|
|
|
|
BOOL WINAPI AddERExcludedApplicationA(LPCSTR lpAppFileName)
|
|
|
|
{
|
|
|
|
int len = MultiByteToWideChar(CP_ACP, 0, lpAppFileName, -1, NULL, 0);
|
|
|
|
WCHAR *wstr;
|
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
TRACE("(%s)\n", wine_dbgstr_a(lpAppFileName));
|
|
|
|
if (len == 0)
|
|
|
|
return FALSE;
|
|
|
|
wstr = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*len);
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, lpAppFileName, -1, wstr, len);
|
|
|
|
ret = AddERExcludedApplicationW(wstr);
|
|
|
|
HeapFree(GetProcessHeap(), 0, wstr);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2007-10-01 23:22:29 +02:00
|
|
|
/*************************************************************************
|
|
|
|
* ReportFault [FAULTREP.@]
|
|
|
|
*/
|
|
|
|
EFaultRepRetVal WINAPI ReportFault(LPEXCEPTION_POINTERS pep, DWORD dwOpt)
|
|
|
|
{
|
|
|
|
FIXME("%p 0x%x stub\n", pep, dwOpt);
|
|
|
|
return frrvOk;
|
|
|
|
}
|
|
|
|
|
2007-07-27 01:43:49 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* DllMain.
|
|
|
|
*/
|
|
|
|
BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
|
|
|
|
{
|
|
|
|
switch(reason)
|
|
|
|
{
|
|
|
|
case DLL_WINE_PREATTACH:
|
|
|
|
return FALSE;
|
|
|
|
case DLL_PROCESS_ATTACH:
|
|
|
|
DisableThreadLibraryCalls(inst);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|