Initial community commit

This commit is contained in:
Jef
2024-09-24 14:54:57 +02:00
parent 537bcbc862
commit 20d28e80a5
16810 changed files with 4640254 additions and 2 deletions
@@ -0,0 +1,814 @@
// ExceptionHandler.cpp Version 1.4
//
// Copyright © 1998 Bruce Dawson
//
// This source file contains the exception handler for recording error
// information after crashes. See ExceptionHandler.h for information
// on how to hook it in.
//
// Author: Bruce Dawson
// brucedawson@cygnus-software.com
//
// Modified by: Hans Dietrich
// hdietrich2@hotmail.com
//
// Version 1.4: - Added invocation of XCrashReport.exe
//
// Version 1.3: - Added minidump output
//
// Version 1.1: - reformatted output for XP-like error report
// - added ascii output to stack dump
//
// A paper by the original author can be found at:
// http://www.cygnus-software.com/papers/release_debugging.html
//
///////////////////////////////////////////////////////////////////////////////
// Disable warnings generated by the Windows header files.
#pragma warning(disable : 4514)
#pragma warning(disable : 4201)
#define _WIN32_WINDOWS 0x0500 // for IsDebuggerPresent
#include "windows.h"
#include <tchar.h>
#include "GetWinVer.h"
#include "miniversion.h"
#include "../nu/ns_wc.h"
#include "minidump.h"
#include ".\settings.h"
#include "api__gen_crasher.h"
extern char *winampVersion;
extern Settings settings;
#ifndef _countof
#define _countof(array) (sizeof(array)/sizeof(array[0]))
#endif
const int NumCodeBytes = 16; // Number of code bytes to record.
const int MaxStackDump = 3072; // Maximum number of DWORDS in stack dumps.
const int StackColumns = 4; // Number of columns in stack dump.
#define ONEK 1024
#define SIXTYFOURK (64*ONEK)
#define ONEM (ONEK*ONEK)
#define ONEG (ONEK*ONEK*ONEK)
///////////////////////////////////////////////////////////////////////////////
// lstrrchr (avoid the C Runtime )
static TCHAR * lstrrchr(LPCTSTR string, int ch)
{
TCHAR *start = (TCHAR *)string;
while (string && *string++) /* find end of string */
;
/* search towards front */
while (--string != start && *string != (TCHAR) ch)
;
if (*string == (TCHAR) ch) /* char found ? */
return (TCHAR *)string;
return NULL;
}
///////////////////////////////////////////////////////////////////////////////
// hprintf behaves similarly to printf, with a few vital differences.
// It uses wvsprintf to do the formatting, which is a system routine,
// thus avoiding C run time interactions. For similar reasons it
// uses WriteFile rather than fwrite.
// The one limitation that this imposes is that wvsprintf, and
// therefore hprintf, cannot handle floating point numbers.
// Too many calls to WriteFile can take a long time, causing
// confusing delays when programs crash. Therefore I implemented
// a simple buffering scheme for hprintf
#define HPRINTF_BUFFER_SIZE (8*1024) // must be at least 2048
static wchar_t hprintf_buffer[HPRINTF_BUFFER_SIZE]; // wvsprintf never prints more than one K.
static int hprintf_index = 0;
///////////////////////////////////////////////////////////////////////////////
// hflush
static void hflush(HANDLE LogFile)
{
if (hprintf_index > 0)
{
DWORD NumBytes = 0;
WriteFile(LogFile, hprintf_buffer, lstrlenW(hprintf_buffer)*2, &NumBytes, 0);
hprintf_index = 0;
}
}
///////////////////////////////////////////////////////////////////////////////
// hprintf
static void hprintf(HANDLE LogFile, const wchar_t *Format, ...)
{
if (hprintf_index > (HPRINTF_BUFFER_SIZE-1024))
{
DWORD NumBytes = 0;
WriteFile(LogFile, hprintf_buffer, lstrlen(hprintf_buffer)*2, &NumBytes, 0);
hprintf_index = 0;
}
va_list arglist;
va_start( arglist, Format);
hprintf_index += vswprintf(&hprintf_buffer[hprintf_index], Format, arglist);
va_end( arglist);
}
#include <strsafe.h>
///////////////////////////////////////////////////////////////////////////////
// DumpMiniDump
static BOOL DumpMiniDump(HANDLE hFile, PEXCEPTION_POINTERS excpInfo)
{
if (excpInfo == NULL)
{
// Generate exception to get proper context in dump
__try
{
//OutputDebugString(_T("raising exception\r\n"));
RaiseException(EXCEPTION_BREAKPOINT, 0, 0, NULL);
}
__except(DumpMiniDump(hFile, GetExceptionInformation()), EXCEPTION_CONTINUE_EXECUTION)
{
}
}
else
{
//OutputDebugString(_T("writing minidump\r\n"));
MINIDUMP_EXCEPTION_INFORMATION eInfo = {0};
eInfo.ThreadId = GetCurrentThreadId();
eInfo.ExceptionPointers = excpInfo;
eInfo.ClientPointers = FALSE;
// try to load dbghelpdll
HMODULE hm = NULL;
// first from app folder
wchar_t szDbgHelpPath[_MAX_PATH] = {0};
if (GetModuleFileNameW( NULL, szDbgHelpPath, _MAX_PATH ))
{
wchar_t *pSlash = wcsrchr( szDbgHelpPath, L'\\' );
if (pSlash)
{
StringCchCopy( pSlash+1, _MAX_PATH, L"dbghelp.dll");
hm = LoadLibraryW( szDbgHelpPath );
}
}
if (!hm)
{
// load any version we can
hm = LoadLibraryW(L"dbghelp.dll");
}
if (hm)
{
BOOL (WINAPI* MiniDumpWriteDump)(
HANDLE hProcess,
DWORD ProcessId,
HANDLE hFile,
MINIDUMP_TYPE DumpType,
PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
PMINIDUMP_CALLBACK_INFORMATION CallbackParam
) = NULL;
//OutputDebugString(_T("Found dbghelp.dll, searching for MiniDumpWriteDump\r\n"));
*(FARPROC*)&MiniDumpWriteDump = GetProcAddress(hm, "MiniDumpWriteDump");
if (MiniDumpWriteDump)
{
//OutputDebugString(_T("Calling MiniDumpWriteDump\r\n"));
BOOL ret = MiniDumpWriteDump(
GetCurrentProcess(),
GetCurrentProcessId(),
hFile,
(MINIDUMP_TYPE)settings.dumpType,
excpInfo ? &eInfo : NULL,
NULL,
NULL);
//OutputDebugString(_T("MiniDumpWriteDump finished\r\n"));
if (!ret)
{
DWORD le = GetLastError();
wchar_t tmp[256] = {0};
StringCchPrintfW(tmp, 256, L"call failed with error code: %d", le);
//OutputDebugString(tmp);
}
return ret;
}
}
}
return FALSE;
}
///////////////////////////////////////////////////////////////////////////////
// FormatTime
//
// Format the specified FILETIME to output in a human readable format,
// without using the C run time.
static void FormatTime(LPTSTR output, FILETIME TimeToPrint)
{
output[0] = _T('\0');
WORD Date, Time;
if (FileTimeToLocalFileTime(&TimeToPrint, &TimeToPrint) &&
FileTimeToDosDateTime(&TimeToPrint, &Date, &Time))
{
StringCchPrintf(output, 100, _T("%d/%d/%d %02d:%02d:%02d"),
(Date / 32) & 15, Date & 31, (Date / 512) + 1980,
(Time >> 11), (Time >> 5) & 0x3F, (Time & 0x1F) * 2);
}
}
///////////////////////////////////////////////////////////////////////////////
// DumpModuleInfo
//
// Print information about a code module (DLL or EXE) such as its size,
// location, time stamp, etc.
static bool DumpModuleInfo(HANDLE LogFile, HINSTANCE ModuleHandle, int nModuleNo)
{
bool rc = false;
wchar_t szModName[MAX_PATH*2] = {0};
__try
{
if (GetModuleFileName(ModuleHandle, szModName, MAX_PATH*2) > 0)
{
// If GetModuleFileName returns greater than zero then this must
// be a valid code module address. Therefore we can try to walk
// our way through its structures to find the link time stamp.
IMAGE_DOS_HEADER *DosHeader = (IMAGE_DOS_HEADER*)ModuleHandle;
if (IMAGE_DOS_SIGNATURE != DosHeader->e_magic)
return false;
IMAGE_NT_HEADERS *NTHeader = (IMAGE_NT_HEADERS*)((char *)DosHeader
+ DosHeader->e_lfanew);
if (IMAGE_NT_SIGNATURE != NTHeader->Signature)
return false;
// open the code module file so that we can get its file date and size
HANDLE ModuleFile = CreateFile(szModName, GENERIC_READ,
FILE_SHARE_READ, 0, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, 0);
TCHAR TimeBuffer[100] = {0};
DWORD FileSize = 0;
if (ModuleFile != INVALID_HANDLE_VALUE)
{
FileSize = GetFileSize(ModuleFile, 0);
FILETIME LastWriteTime;
if (GetFileTime(ModuleFile, 0, 0, &LastWriteTime))
{
FormatTime(TimeBuffer, LastWriteTime);
}
CloseHandle(ModuleFile);
}
hprintf(LogFile, _T("Module %d\r\n"), nModuleNo);
hprintf(LogFile, _T("%s\r\n"), szModName);
hprintf(LogFile, _T("Image Base: 0x%08x Image Size: 0x%08x\r\n"),
NTHeader->OptionalHeader.ImageBase,
NTHeader->OptionalHeader.SizeOfImage),
hprintf(LogFile, _T("Checksum: 0x%08x Time Stamp: 0x%08x\r\n"),
NTHeader->OptionalHeader.CheckSum,
NTHeader->FileHeader.TimeDateStamp);
hprintf(LogFile, _T("File Size: %-10d File Time: %s\r\n"),
FileSize, TimeBuffer);
hprintf(LogFile, _T("Version Information:\r\n"));
CMiniVersion ver(szModName);
TCHAR szBuf[200] = {0};
WORD dwBuf[4] = {0};
ver.GetCompanyName(szBuf, _countof(szBuf)-1);
hprintf(LogFile, _T(" Company: %s\r\n"), szBuf);
ver.GetProductName(szBuf, _countof(szBuf)-1);
hprintf(LogFile, _T(" Product: %s\r\n"), szBuf);
ver.GetFileDescription(szBuf, _countof(szBuf)-1);
hprintf(LogFile, _T(" FileDesc: %s\r\n"), szBuf);
ver.GetFileVersion(dwBuf);
hprintf(LogFile, _T(" FileVer: %d.%d.%d.%d\r\n"),
dwBuf[0], dwBuf[1], dwBuf[2], dwBuf[3]);
ver.GetProductVersion(dwBuf);
hprintf(LogFile, _T(" ProdVer: %d.%d.%d.%d\r\n"),
dwBuf[0], dwBuf[1], dwBuf[2], dwBuf[3]);
ver.Release();
hprintf(LogFile, _T("\r\n"));
rc = true;
}
}
// Handle any exceptions by continuing from this point.
__except(EXCEPTION_EXECUTE_HANDLER)
{
//OutputDebugString(L"DumpModuleInfo exception");
}
return rc;
}
///////////////////////////////////////////////////////////////////////////////
// DumpModuleList
//
// Scan memory looking for code modules (DLLs or EXEs). VirtualQuery is used
// to find all the blocks of address space that were reserved or committed,
// and ShowModuleInfo will display module information if they are code
// modules.
static void DumpModuleList(HANDLE LogFile)
{
SYSTEM_INFO SystemInfo;
GetSystemInfo(&SystemInfo);
//OutputDebugString(L"Dumping modules list");
const size_t PageSize = SystemInfo.dwPageSize;
// Set NumPages to the number of pages in the 4GByte address space,
// while being careful to avoid overflowing ints
const size_t NumPages = 4 * size_t(ONEG / PageSize);
size_t pageNum = 0;
void *LastAllocationBase = 0;
int nModuleNo = 1;
while (pageNum < NumPages)
{
MEMORY_BASIC_INFORMATION MemInfo;
if (VirtualQuery((void *)(pageNum * PageSize), &MemInfo, sizeof(MemInfo)))
{
if (MemInfo.RegionSize > 0)
{
// Adjust the page number to skip over this block of memory
pageNum += MemInfo.RegionSize / PageSize;
if (MemInfo.State == MEM_COMMIT && MemInfo.AllocationBase > LastAllocationBase)
{
// Look for new blocks of committed memory, and try
// recording their module names - this will fail
// gracefully if they aren't code modules
LastAllocationBase = MemInfo.AllocationBase;
if (DumpModuleInfo(LogFile, (HINSTANCE)LastAllocationBase, nModuleNo))
{
nModuleNo++;
}
}
}
else
pageNum += SIXTYFOURK / PageSize;
}
else
pageNum += SIXTYFOURK / PageSize;
// If VirtualQuery fails we advance by 64K because that is the
// granularity of address space doled out by VirtualAlloc()
}
}
///////////////////////////////////////////////////////////////////////////////
// DumpSystemInformation
//
// Record information about the user's system, such as processor type, amount
// of memory, etc.
static void DumpSystemInformation(HANDLE LogFile)
{
FILETIME CurrentTime;
GetSystemTimeAsFileTime(&CurrentTime);
TCHAR szTimeBuffer[100] = {0};
FormatTime(szTimeBuffer, CurrentTime);
hprintf(LogFile, _T("Error occurred at %s.\r\n"), szTimeBuffer);
TCHAR szModuleName[MAX_PATH*2] = {0};
if (GetModuleFileName(0, szModuleName, _countof(szModuleName)-2) <= 0)
StringCbCopy(szModuleName, sizeof(szModuleName), _T("Unknown"));
TCHAR szUserName[200] = {0};
DWORD UserNameSize = _countof(szUserName)-2;
if (!GetUserName(szUserName, &UserNameSize))
StringCbCopy(szUserName, sizeof(szUserName), _T("Unknown"));
hprintf(LogFile, _T("%s, run by %s.\r\n"), szModuleName, szUserName);
// print out operating system
TCHAR szWinVer[50] = {0}, szMajorMinorBuild[50] = {0};
int nWinVer = 0;
GetWinVer(szWinVer, &nWinVer, szMajorMinorBuild);
hprintf(LogFile, _T("Operating system: %s (%s).\r\n"),
szWinVer, szMajorMinorBuild);
SYSTEM_INFO SystemInfo;
GetSystemInfo(&SystemInfo);
hprintf(LogFile, _T("%d processor(s), type %d.\r\n"),
SystemInfo.dwNumberOfProcessors, SystemInfo.dwProcessorType);
MEMORYSTATUS MemInfo;
MemInfo.dwLength = sizeof(MemInfo);
GlobalMemoryStatus(&MemInfo);
// Print out info on memory, rounded up.
hprintf(LogFile, _T("%d%% memory in use.\r\n"), MemInfo.dwMemoryLoad);
hprintf(LogFile, _T("%d MBytes physical memory.\r\n"), (MemInfo.dwTotalPhys +
ONEM - 1) / ONEM);
hprintf(LogFile, _T("%d MBytes physical memory free.\r\n"),
(MemInfo.dwAvailPhys + ONEM - 1) / ONEM);
hprintf(LogFile, _T("%d MBytes paging file.\r\n"), (MemInfo.dwTotalPageFile +
ONEM - 1) / ONEM);
hprintf(LogFile, _T("%d MBytes paging file free.\r\n"),
(MemInfo.dwAvailPageFile + ONEM - 1) / ONEM);
hprintf(LogFile, _T("%d MBytes user address space.\r\n"),
(MemInfo.dwTotalVirtual + ONEM - 1) / ONEM);
hprintf(LogFile, _T("%d MBytes user address space free.\r\n"),
(MemInfo.dwAvailVirtual + ONEM - 1) / ONEM);
}
///////////////////////////////////////////////////////////////////////////////
// GetExceptionDescription
//
// Translate the exception code into something human readable
static const TCHAR *GetExceptionDescription(DWORD ExceptionCode)
{
struct ExceptionNames
{
DWORD ExceptionCode;
TCHAR * ExceptionName;
};
#if 0 // from winnt.h
#define STATUS_WAIT_0 ((DWORD )0x00000000L)
#define STATUS_ABANDONED_WAIT_0 ((DWORD )0x00000080L)
#define STATUS_USER_APC ((DWORD )0x000000C0L)
#define STATUS_TIMEOUT ((DWORD )0x00000102L)
#define STATUS_PENDING ((DWORD )0x00000103L)
#define STATUS_SEGMENT_NOTIFICATION ((DWORD )0x40000005L)
#define STATUS_GUARD_PAGE_VIOLATION ((DWORD )0x80000001L)
#define STATUS_DATATYPE_MISALIGNMENT ((DWORD )0x80000002L)
#define STATUS_BREAKPOINT ((DWORD )0x80000003L)
#define STATUS_SINGLE_STEP ((DWORD )0x80000004L)
#define STATUS_ACCESS_VIOLATION ((DWORD )0xC0000005L)
#define STATUS_IN_PAGE_ERROR ((DWORD )0xC0000006L)
#define STATUS_INVALID_HANDLE ((DWORD )0xC0000008L)
#define STATUS_NO_MEMORY ((DWORD )0xC0000017L)
#define STATUS_ILLEGAL_INSTRUCTION ((DWORD )0xC000001DL)
#define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD )0xC0000025L)
#define STATUS_INVALID_DISPOSITION ((DWORD )0xC0000026L)
#define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD )0xC000008CL)
#define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD )0xC000008DL)
#define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD )0xC000008EL)
#define STATUS_FLOAT_INEXACT_RESULT ((DWORD )0xC000008FL)
#define STATUS_FLOAT_INVALID_OPERATION ((DWORD )0xC0000090L)
#define STATUS_FLOAT_OVERFLOW ((DWORD )0xC0000091L)
#define STATUS_FLOAT_STACK_CHECK ((DWORD )0xC0000092L)
#define STATUS_FLOAT_UNDERFLOW ((DWORD )0xC0000093L)
#define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD )0xC0000094L)
#define STATUS_INTEGER_OVERFLOW ((DWORD )0xC0000095L)
#define STATUS_PRIVILEGED_INSTRUCTION ((DWORD )0xC0000096L)
#define STATUS_STACK_OVERFLOW ((DWORD )0xC00000FDL)
#define STATUS_CONTROL_C_EXIT ((DWORD )0xC000013AL)
#define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD )0xC00002B4L)
#define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD )0xC00002B5L)
#define STATUS_ILLEGAL_VLM_REFERENCE ((DWORD )0xC00002C0L)
#endif
ExceptionNames ExceptionMap[] =
{
{0x40010005, _T("a Control-C")},
{0x40010008, _T("a Control-Break")},
{0x80000002, _T("a Datatype Misalignment")},
{0x80000003, _T("a Breakpoint")},
{0xc0000005, _T("an Access Violation")},
{0xc0000006, _T("an In Page Error")},
{0xc0000017, _T("a No Memory")},
{0xc000001d, _T("an Illegal Instruction")},
{0xc0000025, _T("a Noncontinuable Exception")},
{0xc0000026, _T("an Invalid Disposition")},
{0xc000008c, _T("a Array Bounds Exceeded")},
{0xc000008d, _T("a Float Denormal Operand")},
{0xc000008e, _T("a Float Divide by Zero")},
{0xc000008f, _T("a Float Inexact Result")},
{0xc0000090, _T("a Float Invalid Operation")},
{0xc0000091, _T("a Float Overflow")},
{0xc0000092, _T("a Float Stack Check")},
{0xc0000093, _T("a Float Underflow")},
{0xc0000094, _T("an Integer Divide by Zero")},
{0xc0000095, _T("an Integer Overflow")},
{0xc0000096, _T("a Privileged Instruction")},
{0xc00000fD, _T("a Stack Overflow")},
{0xc0000142, _T("a DLL Initialization Failed")},
{0xe06d7363, _T("a Microsoft C++ Exception")},
};
for (int i = 0; i < _countof(ExceptionMap); i++)
if (ExceptionCode == ExceptionMap[i].ExceptionCode)
return ExceptionMap[i].ExceptionName;
return _T("an Unknown exception type");
}
///////////////////////////////////////////////////////////////////////////////
// GetFilePart
static TCHAR * GetFilePart(LPCTSTR source)
{
TCHAR *result = lstrrchr(source, _T('\\'));
if (result)
result++;
else
result = (TCHAR *)source;
return result;
}
#ifdef _M_IX86
///////////////////////////////////////////////////////////////////////////////
// DumpStack
static void DumpStack(HANDLE LogFile, DWORD *pStack)
{
hprintf(LogFile, _T("\r\n\r\nStack:\r\n"));
__try
{
// Esp contains the bottom of the stack, or at least the bottom of
// the currently used area.
DWORD* pStackTop;
__asm
{
// Load the top (highest address) of the stack from the
// thread information block. It will be found there in
// Win9x and Windows NT.
mov eax, fs:[4]
mov pStackTop, eax
}
if (pStackTop > pStack + MaxStackDump)
pStackTop = pStack + MaxStackDump;
int Count = 0;
DWORD* pStackStart = pStack;
int nDwordsPrinted = 0;
while (pStack + 1 <= pStackTop)
{
if ((Count % StackColumns) == 0)
{
pStackStart = pStack;
nDwordsPrinted = 0;
hprintf(LogFile, _T("0x%08x: "), pStack);
}
hprintf(LogFile, _T("%08x "), pStack);
if ((++Count % StackColumns) == 0 || pStack + 2 > pStackTop)
{
nDwordsPrinted++;
int n = nDwordsPrinted;
while (n < 4)
{
hprintf(LogFile, _T(" "));
n++;
}
for (int i = 0; i < nDwordsPrinted; i++)
{
DWORD dwStack = *pStackStart;
for (int j = 0; j < 4; j++)
{
char c = (char)(dwStack & 0xFF);
if (c < 0x20 || c > 0x7E)
c = '.';
#ifdef _UNICODE
WCHAR w = (WCHAR)c;
hprintf(LogFile, _T("%c"), w);
#else
hprintf(LogFile, _T("%c"), c);
#endif
dwStack = dwStack >> 8;
}
pStackStart++;
}
hprintf(LogFile, _T("\r\n"));
}
else
{
// hprintf(LogFile, _T("%08x "), *pStack);
nDwordsPrinted++;
}
pStack++;
}
hprintf(LogFile, _T("\r\n"));
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
hprintf(LogFile, _T("Exception encountered during stack dump.\r\n"));
}
}
///////////////////////////////////////////////////////////////////////////////
// DumpRegisters
static void DumpRegisters(HANDLE LogFile, PCONTEXT Context)
{
// Print out the register values in an XP error window compatible format.
hprintf(LogFile, _T("\r\n"));
hprintf(LogFile, _T("Context:\r\n"));
hprintf(LogFile, _T("EDI: 0x%08x ESI: 0x%08x EAX: 0x%08x\r\n"),
Context->Edi, Context->Esi, Context->Eax);
hprintf(LogFile, _T("EBX: 0x%08x ECX: 0x%08x EDX: 0x%08x\r\n"),
Context->Ebx, Context->Ecx, Context->Edx);
hprintf(LogFile, _T("EIP: 0x%08x EBP: 0x%08x SegCs: 0x%08x\r\n"),
Context->Eip, Context->Ebp, Context->SegCs);
hprintf(LogFile, _T("EFlags: 0x%08x ESP: 0x%08x SegSs: 0x%08x\r\n"),
Context->EFlags, Context->Esp, Context->SegSs);
}
#endif
BOOL CreateLog(PEXCEPTION_POINTERS pExceptPtrs, LPCWSTR lpszMessage)
{
HANDLE hLogFile = CreateFile(settings.logPath, GENERIC_WRITE, 0, 0,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH, 0);
if (hLogFile == INVALID_HANDLE_VALUE)
{
//OutputDebugString(_T("Error creating exception report\r\n"));
return FALSE;
}
// add BOM
WORD wBOM = 0xFEFF;
DWORD num = 0;
WriteFile(hLogFile, &wBOM, sizeof(WORD), &num, NULL);
// Append to the error log
SetFilePointer(hLogFile, 0, 0, FILE_END);
wchar_t line[1024] = {0};
wchar_t msgBody[4*1024] = {0};
wchar_t winampVersionWide[1024] = {0};
MultiByteToWideCharSZ(CP_ACP, 0, winampVersion, -1, winampVersionWide, 1024);
StringCchPrintf(line, 1024, L"Winamp client version: %s\r\n", winampVersionWide);
StringCchCopy(msgBody, 4*1024, line);
PEXCEPTION_RECORD Exception = pExceptPtrs->ExceptionRecord;
PCONTEXT Context = pExceptPtrs->ContextRecord;
TCHAR szCrashModulePathName[MAX_PATH*2] = {0};
TCHAR *pszCrashModuleFileName = _T("Unknown");
#ifdef _M_IX86
MEMORY_BASIC_INFORMATION MemInfo;
// VirtualQuery can be used to get the allocation base associated with a
// code address, which is the same as the ModuleHandle. This can be used
// to get the filename of the module that the crash happened in.
if (VirtualQuery((void*)Context->Eip, &MemInfo, sizeof(MemInfo)) &&
(GetModuleFileName((HINSTANCE)MemInfo.AllocationBase,
szCrashModulePathName,
sizeof(szCrashModulePathName)-2) > 0))
{
//OutputDebugString(szCrashModulePathName);
pszCrashModuleFileName = GetFilePart(szCrashModulePathName);
}
#endif
// Print out the beginning of the error log in a Win95 error window
// compatible format.
TCHAR szModuleName[MAX_PATH*2] = {0};
if (GetModuleFileName(0, szModuleName, _countof(szModuleName)-2) <= 0)
StringCbCopy(szModuleName, sizeof(szModuleName), _T("Unknown"));
TCHAR *pszFilePart = GetFilePart(szModuleName);
// Extract the file name portion and remove it's file extension
TCHAR szFileName[MAX_PATH*2] = {0};
StringCbCopy(szFileName, sizeof(szFileName), pszFilePart);
TCHAR *lastperiod = lstrrchr(szFileName, _T('.'));
if (lastperiod)
lastperiod[0] = 0;
#ifdef _M_IX86
StringCchPrintf(line, 1024, L"%s caused %s (0x%08x) \r\nin module %s at %04x:%08x.\r\n\r\n",
szFileName, GetExceptionDescription(Exception->ExceptionCode),
Exception->ExceptionCode,
pszCrashModuleFileName, Context->SegCs, Context->Eip);
#endif
StringCchCat(msgBody, 4*1024, line);
StringCchPrintf(line, 1024, L"Exception handler called in %s.\r\n", lpszMessage);
StringCchCat(msgBody, 4*1024, line);
hprintf(hLogFile, L"%s", msgBody);
wchar_t *p = msgBody, *end = msgBody + wcslen(msgBody);
while(p != end)
{
if (*p == L'\r') *p = 1;
if (*p == L'\n') *p = 2;
p++;
}
settings.WriteBody(msgBody);
if (settings.logSystem)
{
DumpSystemInformation(hLogFile);
// If the exception was an access violation, print out some additional
// information, to the error log and the debugger.
if (Exception->ExceptionCode == STATUS_ACCESS_VIOLATION &&
Exception->NumberParameters >= 2)
{
TCHAR szDebugMessage[1000] = {0};
const TCHAR* readwrite = _T("Read from");
if (Exception->ExceptionInformation[0])
readwrite = _T("Write to");
StringCchPrintf(szDebugMessage, 1000, _T("%s location %08x caused an access violation.\r\n"),
readwrite, Exception->ExceptionInformation[1]);
hprintf(hLogFile, _T("%s"), szDebugMessage);
}
}
if (settings.logRegistry)
{
#ifdef _M_IX86
DumpRegisters(hLogFile, Context);
#endif
// Print out the bytes of code at the instruction pointer. Since the
// crash may have been caused by an instruction pointer that was bad,
// this code needs to be wrapped in an exception handler, in case there
// is no memory to read. If the dereferencing of code[] fails, the
// exception handler will print '??'.
#ifdef _M_IX86
hprintf(hLogFile, _T("\r\nBytes at CS:EIP:\r\n"));
BYTE * code = (BYTE *)Context->Eip;
for (int codebyte = 0; codebyte < NumCodeBytes; codebyte++)
{
__try
{
hprintf(hLogFile, _T("%02x "), code[codebyte]);
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
hprintf(hLogFile, _T("?? "));
}
}
#endif
}
if (settings.logStack)
{
// Time to print part or all of the stack to the error log. This allows
// us to figure out the call stack, parameters, local variables, etc.
// Esp contains the bottom of the stack, or at least the bottom of
// the currently used area
#ifdef _M_IX86
DWORD* pStack = (DWORD *)Context->Esp;
DumpStack(hLogFile, pStack);
#endif
}
if (settings.logModule)
{
DumpModuleList(hLogFile);
}
hprintf(hLogFile, _T("\r\n===== [end of log file] =====\r\n"));
hflush(hLogFile);
CloseHandle(hLogFile);
return TRUE;
}
BOOL CreateDump(PEXCEPTION_POINTERS pExceptPtrs)
{
BOOL retCode = FALSE;
// Create the file
//OutputDebugString(_T("CreateFile: "));
//OutputDebugString(settings.dumpPath);
HANDLE hMiniDumpFile = CreateFile(
settings.dumpPath,
GENERIC_WRITE,
0,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH,
NULL);
// Write the minidump to the file
if (hMiniDumpFile != INVALID_HANDLE_VALUE)
{
retCode = DumpMiniDump(hMiniDumpFile, pExceptPtrs);
// Close file
CloseHandle(hMiniDumpFile);
if (!retCode) DeleteFile(settings.dumpPath);
}
return retCode;
}
@@ -0,0 +1,33 @@
// ExceptionHandler.h Version 1.1
//
// Copyright © 1998 Bruce Dawson
//
// Author: Bruce Dawson
// brucedawson@cygnus-software.com
//
// Modified by: Hans Dietrich
// hdietrich2@hotmail.com
//
// A paper by the original author can be found at:
// http://www.cygnus-software.com/papers/release_debugging.html
//
///////////////////////////////////////////////////////////////////////////////
#ifndef EXCEPTIONHANDLER_H
#define EXCEPTIONHANDLER_H
BOOL CreateLog(PEXCEPTION_POINTERS pExceptPtrs, LPCWSTR lpszMessage);
BOOL CreateDump(PEXCEPTION_POINTERS pExceptPtrs);
// We forward declare PEXCEPTION_POINTERS so that the function
// prototype doesn't needlessly require windows.h.
#ifdef __cplusplus
extern "C"
{
#endif
#ifdef __cplusplus
}
#endif
#endif
@@ -0,0 +1,195 @@
// GetWinVer.cpp Version 1.1
//
// Copyright (C) 2001-2003 Hans Dietrich
//
// This software is released into the public domain.
// You are free to use it in any way you like, except
// that you may not sell this source code.
//
// This software is provided "as is" with no expressed
// or implied warranty. I accept no liability for any
// damage or loss of business that this software may cause.
//
///////////////////////////////////////////////////////////////////////////////
//#include "tchar.h"
#include "GetWinVer.h"
// from winbase.h
#ifndef VER_PLATFORM_WIN32s
#define VER_PLATFORM_WIN32s 0
#endif
#ifndef VER_PLATFORM_WIN32_WINDOWS
#define VER_PLATFORM_WIN32_WINDOWS 1
#endif
#ifndef VER_PLATFORM_WIN32_NT
#define VER_PLATFORM_WIN32_NT 2
#endif
#ifndef VER_PLATFORM_WIN32_CE
#define VER_PLATFORM_WIN32_CE 3
#endif
/*
This table has been assembled from Usenet postings, personal
observations, and reading other people's code. Please feel
free to add to it or correct it.
dwPlatFormID dwMajorVersion dwMinorVersion dwBuildNumber
95 1 4 0 950
95 SP1 1 4 0 >950 && <=1080
95 OSR2 1 4 <10 >1080
98 1 4 10 1998
98 SP1 1 4 10 >1998 && <2183
98 SE 1 4 10 >=2183
ME 1 4 90 3000
NT 3.51 2 3 51
NT 4 2 4 0 1381
2000 2 5 0 2195
XP 2 5 1 2600
2003 Server 2 5 2 3790
VISTA 2 6 0 6000
7 2 6 1 7600
8 2 6 2 9200
8.1 2 6 3 9600
10 2 10 0 10240
11 2 11 0 22000
CE 3
*/
///////////////////////////////////////////////////////////////////////////////
// GetWinVer
BOOL GetWinVer(LPWSTR pszVersion, int *nVersion, LPWSTR pszMajorMinorBuild)
{
if (!pszVersion || !nVersion || !pszMajorMinorBuild)
return FALSE;
lstrcpy(pszVersion, WUNKNOWNSTR);
*nVersion = WUNKNOWN;
DWORD (WINAPI *RtlGetVersion)(LPOSVERSIONINFOEXW);
OSVERSIONINFOEXW osinfo;
*(FARPROC*)&RtlGetVersion = GetProcAddress(GetModuleHandleW(L"ntdll"), "RtlGetVersion");
if (!RtlGetVersion) {
return FALSE;
}
osinfo.dwOSVersionInfoSize = sizeof(osinfo);
if (RtlGetVersion(&osinfo)) {
return FALSE;
}
DWORD dwPlatformId = osinfo.dwPlatformId;
DWORD dwMajorVersion = osinfo.dwMajorVersion;
DWORD dwMinorVersion = osinfo.dwMinorVersion;
DWORD dwBuildNumber = osinfo.dwBuildNumber & 0xFFFF; // Win 95 needs this
wsprintfW(pszMajorMinorBuild, L"%u.%u.%u", dwMajorVersion, dwMinorVersion, dwBuildNumber);
if ((dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) && (dwMajorVersion == 4))
{
if ((dwMinorVersion < 10) && (dwBuildNumber == 950))
{
lstrcpy(pszVersion, W95STR);
*nVersion = W95;
}
else if ((dwMinorVersion < 10) &&
((dwBuildNumber > 950) && (dwBuildNumber <= 1080)))
{
lstrcpy(pszVersion, W95SP1STR);
*nVersion = W95SP1;
}
else if ((dwMinorVersion < 10) && (dwBuildNumber > 1080))
{
lstrcpy(pszVersion, W95OSR2STR);
*nVersion = W95OSR2;
}
else if ((dwMinorVersion == 10) && (dwBuildNumber == 1998))
{
lstrcpy(pszVersion, W98STR);
*nVersion = W98;
}
else if ((dwMinorVersion == 10) &&
((dwBuildNumber > 1998) && (dwBuildNumber < 2183)))
{
lstrcpy(pszVersion, W98SP1STR);
*nVersion = W98SP1;
}
else if ((dwMinorVersion == 10) && (dwBuildNumber >= 2183))
{
lstrcpy(pszVersion, W98SESTR);
*nVersion = W98SE;
}
else if (dwMinorVersion == 90)
{
lstrcpy(pszVersion, WMESTR);
*nVersion = WME;
}
}
else if (dwPlatformId == VER_PLATFORM_WIN32_NT)
{
if ((dwMajorVersion == 3) && (dwMinorVersion == 51))
{
lstrcpy(pszVersion, WNT351STR);
*nVersion = WNT351;
}
else if ((dwMajorVersion == 4) && (dwMinorVersion == 0))
{
lstrcpy(pszVersion, WNT4STR);
*nVersion = WNT4;
}
else if ((dwMajorVersion == 5) && (dwMinorVersion == 0))
{
lstrcpy(pszVersion, W2KSTR);
*nVersion = W2K;
}
else if ((dwMajorVersion == 5) && (dwMinorVersion == 1))
{
lstrcpy(pszVersion, WXPSTR);
*nVersion = WXP;
}
else if ((dwMajorVersion == 5) && (dwMinorVersion == 2))
{
lstrcpy(pszVersion, W2003SERVERSTR);
*nVersion = W2003SERVER;
}
else if ((dwMajorVersion == 6) && (dwMinorVersion == 0))
{
lstrcpy(pszVersion, WVSTR);
*nVersion = WV;
}
else if ((dwMajorVersion == 6) && (dwMinorVersion == 1))
{
lstrcpy(pszVersion, W7STR);
*nVersion = W7;
}
else if ((dwMajorVersion == 6) && (dwMinorVersion == 2))
{
lstrcpy(pszVersion, W8STR);
*nVersion = W8;
}
else if ((dwMajorVersion == 6) && (dwMinorVersion == 3))
{
lstrcpy(pszVersion, W81STR);
*nVersion = W81;
}
else if ((dwMajorVersion == 10) && (dwMinorVersion == 0) && (dwBuildNumber < 22000))
{
lstrcpy(pszVersion, W10STR);
*nVersion = W10;
}
else if ((dwMajorVersion == 10) && (dwMinorVersion == 0) && (dwBuildNumber >= 22000))
{
lstrcpy(pszVersion, W11STR);
*nVersion = W11;
}
}
else if (dwPlatformId == VER_PLATFORM_WIN32_CE)
{
lstrcpy(pszVersion, WCESTR);
*nVersion = WCE;
}
return TRUE;
}
@@ -0,0 +1,76 @@
// GetWinVer.h Version 1.1
//
// Copyright (C) 2001-2003 Hans Dietrich
//
// This software is released into the public domain.
// You are free to use it in any way you like, except
// that you may not sell this source code.
//
// This software is provided "as is" with no expressed
// or implied warranty. I accept no liability for any
// damage or loss of business that this software may cause.
//
///////////////////////////////////////////////////////////////////////////////
#include <windows.h>
#ifndef GETWINVER_H
#define GETWINVER_H
#define WUNKNOWNSTR L"Windows [Unknown version]"
#define W95STR L"Windows 95"
#define W95SP1STR L"Windows 95 SP1"
#define W95OSR2STR L"Windows 95 OSR2"
#define W98STR L"Windows 98"
#define W98SP1STR L"Windows 98 SP1"
#define W98SESTR L"Windows 98 SE"
#define WMESTR L"Windows ME"
#define WNT351STR L"Windows NT 3.51"
#define WNT4STR L"Windows NT 4"
#define W2KSTR L"Windows 2000"
#define WXPSTR L"Windows XP"
#define W2003SERVERSTR L"Windows 2003 Server"
#define WVSTR L"Windows Vista"
#define W7STR L"Windows 7"
#define W8STR L"Windows 8"
#define W81STR L"Windows 8.1"
#define W10STR L"Windows 10"
#define W11STR L"Windows 11"
#define WCESTR L"Windows CE"
#define WUNKNOWN 0
#define W9XFIRST 1
#define W95 1
#define W95SP1 2
#define W95OSR2 3
#define W98 4
#define W98SP1 5
#define W98SE 6
#define WME 7
#define W9XLAST 99
#define WNTFIRST 101
#define WNT351 101
#define WNT4 102
#define W2K 103
#define WXP 104
#define W2003SERVER 105
#define WV 106
#define W7 107
#define W8 108
#define W81 109
#define W10 110
#define W11 111
#define WNTLAST 199
#define WCEFIRST 201
#define WCE 201
#define WCELAST 299
BOOL GetWinVer(LPWSTR pszVersion, int *nVersion, LPWSTR pszMajorMinorBuild);
#endif //GETWINVER_H
@@ -0,0 +1,267 @@
// MiniVersion.cpp Version 1.1
//
// Author: Hans Dietrich
// hdietrich2@hotmail.com
//
// This software is released into the public domain.
// You are free to use it in any way you like, except
// that you may not sell this source code.
//
// This software is provided "as is" with no expressed
// or implied warranty. I accept no liability for any
// damage or loss of business that this software may cause.
//
///////////////////////////////////////////////////////////////////////////////
#include "MiniVersion.h"
#include <strsafe.h>
///////////////////////////////////////////////////////////////////////////////
// ctor
CMiniVersion::CMiniVersion(LPCTSTR lpszPath)
{
ZeroMemory(m_szPath, sizeof(m_szPath));
if (lpszPath && lpszPath[0] != 0)
{
lstrcpyn(m_szPath, lpszPath, sizeof(m_szPath)-1);
}
else
{
}
m_pData = NULL;
m_dwHandle = 0;
for (int i = 0; i < 4; i++)
{
m_wFileVersion[i] = 0;
m_wProductVersion[i] = 0;
}
m_dwFileFlags = 0;
m_dwFileOS = 0;
m_dwFileType = 0;
m_dwFileSubtype = 0;
ZeroMemory(m_szCompanyName, sizeof(m_szCompanyName));
ZeroMemory(m_szProductName, sizeof(m_szProductName));
ZeroMemory(m_szFileDescription, sizeof(m_szFileDescription));
Init();
}
///////////////////////////////////////////////////////////////////////////////
// Init
BOOL CMiniVersion::Init()
{
DWORD dwHandle;
DWORD dwSize;
BOOL rc;
dwSize = ::GetFileVersionInfoSize((LPCTSTR)m_szPath, &dwHandle);
if (dwSize == 0)
return FALSE;
m_pData = new BYTE [dwSize + 1];
ZeroMemory(m_pData, dwSize+1);
rc = ::GetFileVersionInfo((LPCTSTR)m_szPath, dwHandle, dwSize, m_pData);
if (!rc)
return FALSE;
// get fixed info
VS_FIXEDFILEINFO FixedInfo;
if (GetFixedInfo(FixedInfo))
{
m_wFileVersion[0] = HIWORD(FixedInfo.dwFileVersionMS);
m_wFileVersion[1] = LOWORD(FixedInfo.dwFileVersionMS);
m_wFileVersion[2] = HIWORD(FixedInfo.dwFileVersionLS);
m_wFileVersion[3] = LOWORD(FixedInfo.dwFileVersionLS);
m_wProductVersion[0] = HIWORD(FixedInfo.dwProductVersionMS);
m_wProductVersion[1] = LOWORD(FixedInfo.dwProductVersionMS);
m_wProductVersion[2] = HIWORD(FixedInfo.dwProductVersionLS);
m_wProductVersion[3] = LOWORD(FixedInfo.dwProductVersionLS);
m_dwFileFlags = FixedInfo.dwFileFlags;
m_dwFileOS = FixedInfo.dwFileOS;
m_dwFileType = FixedInfo.dwFileType;
m_dwFileSubtype = FixedInfo.dwFileSubtype;
}
else
return FALSE;
// get string info
GetStringInfo(_T("CompanyName"), m_szCompanyName, MAX_PATH*2);
GetStringInfo(_T("FileDescription"), m_szFileDescription, MAX_PATH*2);
GetStringInfo(_T("ProductName"), m_szProductName, MAX_PATH*2);
return TRUE;
}
///////////////////////////////////////////////////////////////////////////////
// Release
void CMiniVersion::Release()
{
// do this manually, because we can't use objects requiring
// a dtor within an exception handler
if (m_pData)
delete [] m_pData;
m_pData = NULL;
}
///////////////////////////////////////////////////////////////////////////////
// GetFileVersion
BOOL CMiniVersion::GetFileVersion(WORD * pwVersion)
{
for (int i = 0; i < 4; i++)
*pwVersion++ = m_wFileVersion[i];
return TRUE;
}
///////////////////////////////////////////////////////////////////////////////
// GetProductVersion
BOOL CMiniVersion::GetProductVersion(WORD * pwVersion)
{
for (int i = 0; i < 4; i++)
*pwVersion++ = m_wProductVersion[i];
return TRUE;
}
///////////////////////////////////////////////////////////////////////////////
// GetFileFlags
BOOL CMiniVersion::GetFileFlags(DWORD& rdwFlags)
{
rdwFlags = m_dwFileFlags;
return TRUE;
}
///////////////////////////////////////////////////////////////////////////////
// GetFileOS
BOOL CMiniVersion::GetFileOS(DWORD& rdwOS)
{
rdwOS = m_dwFileOS;
return TRUE;
}
///////////////////////////////////////////////////////////////////////////////
// GetFileType
BOOL CMiniVersion::GetFileType(DWORD& rdwType)
{
rdwType = m_dwFileType;
return TRUE;
}
///////////////////////////////////////////////////////////////////////////////
// GetFileSubtype
BOOL CMiniVersion::GetFileSubtype(DWORD& rdwType)
{
rdwType = m_dwFileSubtype;
return TRUE;
}
///////////////////////////////////////////////////////////////////////////////
// GetCompanyName
BOOL CMiniVersion::GetCompanyName(LPTSTR lpszCompanyName, int nSize)
{
if (!lpszCompanyName)
return FALSE;
ZeroMemory(lpszCompanyName, nSize);
lstrcpyn(lpszCompanyName, m_szCompanyName, nSize-1);
return TRUE;
}
///////////////////////////////////////////////////////////////////////////////
// GetFileDescription
BOOL CMiniVersion::GetFileDescription(LPTSTR lpszFileDescription, int nSize)
{
if (!lpszFileDescription)
return FALSE;
ZeroMemory(lpszFileDescription, nSize);
lstrcpyn(lpszFileDescription, m_szFileDescription, nSize-1);
return TRUE;
}
///////////////////////////////////////////////////////////////////////////////
// GetProductName
BOOL CMiniVersion::GetProductName(LPTSTR lpszProductName, int nSize)
{
if (!lpszProductName)
return FALSE;
ZeroMemory(lpszProductName, nSize);
lstrcpyn(lpszProductName, m_szProductName, nSize-1);
return TRUE;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//
// protected methods
//
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// GetFixedInfo
BOOL CMiniVersion::GetFixedInfo(VS_FIXEDFILEINFO& rFixedInfo)
{
BOOL rc;
UINT nLength;
VS_FIXEDFILEINFO *pFixedInfo = NULL;
if (!m_pData)
return FALSE;
if (m_pData)
rc = ::VerQueryValue(m_pData, _T("\\"), (void **) &pFixedInfo, &nLength);
else
rc = FALSE;
if (rc)
memcpy (&rFixedInfo, pFixedInfo, sizeof (VS_FIXEDFILEINFO));
return rc;
}
///////////////////////////////////////////////////////////////////////////////
// GetStringInfo
BOOL CMiniVersion::GetStringInfo(LPCTSTR lpszKey, LPTSTR lpszReturnValue, unsigned int cchBuffer)
{
BOOL rc;
DWORD *pdwTranslation;
UINT nLength;
LPTSTR lpszValue;
if (m_pData == NULL)
return FALSE;
if (!lpszReturnValue)
return FALSE;
if (!lpszKey)
return FALSE;
*lpszReturnValue = 0;
rc = ::VerQueryValue(m_pData, _T("\\VarFileInfo\\Translation"),
(void**) &pdwTranslation, &nLength);
if (!rc)
return FALSE;
TCHAR szKey[2000] = {0};
StringCchPrintf(szKey, 2000, _T("\\StringFileInfo\\%04x%04x\\%s"), LOWORD (*pdwTranslation), HIWORD (*pdwTranslation), lpszKey);
rc = ::VerQueryValue(m_pData, szKey, (void**) &lpszValue, &nLength);
if (!rc)
return FALSE;
StringCchCopy(lpszReturnValue,cchBuffer, lpszValue);
return TRUE;
}
@@ -0,0 +1,69 @@
// MiniVersion.h Version 1.1
//
// Author: Hans Dietrich
// hdietrich2@hotmail.com
//
// This software is released into the public domain.
// You are free to use it in any way you like, except
// that you may not sell this source code.
//
// This software is provided "as is" with no expressed
// or implied warranty. I accept no liability for any
// damage or loss of business that this software may cause.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef MINIVERSION_H
#define MINIVERSION_H
#include <windows.h>
#include <TCHAR.h>
class CMiniVersion
{
// constructors
public:
CMiniVersion(LPCTSTR lpszPath = NULL);
BOOL Init();
void Release();
// operations
public:
// attributes
public:
// fixed info
BOOL GetFileVersion(WORD *pwVersion);
BOOL GetProductVersion(WORD* pwVersion);
BOOL GetFileFlags(DWORD& rdwFlags);
BOOL GetFileOS(DWORD& rdwOS);
BOOL GetFileType(DWORD& rdwType);
BOOL GetFileSubtype(DWORD& rdwType);
// string info
BOOL GetCompanyName(LPTSTR lpszCompanyName, int nSize);
BOOL GetFileDescription(LPTSTR lpszFileDescription, int nSize);
BOOL GetProductName(LPTSTR lpszProductName, int nSize);
// implementation
protected:
BOOL GetFixedInfo(VS_FIXEDFILEINFO& rFixedInfo);
BOOL GetStringInfo(LPCTSTR lpszKey, LPTSTR lpszValue, unsigned int cchBuffer);
BYTE* m_pData;
DWORD m_dwHandle;
WORD m_wFileVersion[4];
WORD m_wProductVersion[4];
DWORD m_dwFileFlags;
DWORD m_dwFileOS;
DWORD m_dwFileType;
DWORD m_dwFileSubtype;
TCHAR m_szPath[MAX_PATH*2];
TCHAR m_szCompanyName[MAX_PATH*2];
TCHAR m_szProductName[MAX_PATH*2];
TCHAR m_szFileDescription[MAX_PATH*2];
};
///////////////////////////////////////////////////////////////////////////////
#endif
@@ -0,0 +1,3 @@
gen_crasher ver 1.0b
@@ -0,0 +1,20 @@
#ifndef NULLSOFT_APIH
#define NULLSOFT_APIH
#include <api/service/api_service.h>
extern api_service *serviceManager;
#define WASABI_API_SVC serviceManager
#include <api/application/api_application.h>
#define WASABI_API_APP applicationApi
#include <api/syscb/api_syscb.h>
#define WASABI_API_SYSCB sysCallbackApi
#include <api/service/waServiceFactory.h>
#include "../Agave/Language/api_language.h"
#endif
+308
View File
@@ -0,0 +1,308 @@
#include <shlwapi.h>
#include "..\..\..\nu\ns_wc.h"
#include "config.h"
#include <strsafe.h>
///////////////////
///
/// UNICODE VERSION
///
/////
ConfigW::ConfigW()
{
emptyBOM = FALSE;
buff[0] = 0;
buffA = NULL;
fileName = NULL;
defSection = NULL;
}
ConfigW::ConfigW(const wchar_t *ini, const wchar_t *section)
{
emptyBOM = FALSE;
buff[0] = 0;
buffA = NULL;
fileName = NULL;
defSection = NULL;
if (SetIniFile(ini)) SetSection(section);
}
ConfigW::~ConfigW()
{
if (fileName) free(fileName);
if (defSection) free(defSection);
if (buffA) free(buffA);
if (emptyBOM) RemoveEmptyFile();
}
void ConfigW::Flush(void)
{
return;
}
BOOL ConfigW::Write(const wchar_t *section, const wchar_t *name, const wchar_t *value)
{
return (fileName) ? WritePrivateProfileString(section, name, value, fileName) : FALSE;
}
BOOL ConfigW::Write(const wchar_t *section, const wchar_t *name, double value)
{
wchar_t tmp[48] = {0};
if (S_OK != StringCchPrintf(tmp, 48, L"%g", value)) return FALSE;
return Write(section, name, tmp);
}
BOOL ConfigW::Write(const wchar_t *section, const wchar_t *name, long long value)
{
wchar_t tmp[32] = {0};
if (S_OK != StringCchPrintf(tmp, 32, L"%I64d", value)) return FALSE;
return Write(section,name, tmp);
}
BOOL ConfigW::Write(const wchar_t *section, const wchar_t *name, int value)
{
wchar_t tmp[16] = {0};
if (S_OK != StringCchPrintf(tmp, 16, L"%d", value)) return FALSE;
return Write(section,name, tmp);
}
BOOL ConfigW::Write(const wchar_t *section, const wchar_t *name, const char *value)
{
int len = (int)strlen(value) + 1;
wchar_t *tmp = (wchar_t*)malloc(len*sizeof(wchar_t));
if (!tmp) return FALSE;
BOOL ret = FALSE;
if (MultiByteToWideCharSZ(CP_ACP, 0, value, -1, tmp, len))
{
ret = Write(section,name, tmp);
}
free(tmp);
return ret;
}
BOOL ConfigW::Write(const wchar_t *name, int value)
{
if(!defSection) return FALSE;
return Write(defSection, name, value);
}
BOOL ConfigW::Write(const wchar_t *name, long long value)
{
if(!defSection) return FALSE;
return Write(defSection, name, value);
}
BOOL ConfigW::Write(const wchar_t *name, double value)
{
if(!defSection) return FALSE;
return Write(defSection, name, value);
}
BOOL ConfigW::Write(const wchar_t *name, const wchar_t *value)
{
if(!defSection) return FALSE;
return Write(defSection, name, value);
}
BOOL ConfigW::Write(const wchar_t *name, const char value)
{
if(!defSection) return FALSE;
return Write(defSection, name, value);
}
int ConfigW::ReadInt(const wchar_t *section, const wchar_t *name, int defvalue)
{
if (!fileName) return defvalue;
return GetPrivateProfileInt(section, name, defvalue, fileName);
}
long long ConfigW::ReadInt64(const wchar_t *section, const wchar_t *name, long long defvalue)
{
if (!fileName) return defvalue;
wchar_t tmp[32] = {0};
if (S_OK != StringCchPrintf(tmp, 32, L"%I64d", defvalue)) return defvalue;
const wchar_t *ret = ReadStringW(section, name, tmp);
return _wtoi64(ret);
}
double ConfigW::ReadDouble(const wchar_t *section, const wchar_t *name, double defvalue)
{
if (!fileName) return defvalue;
wchar_t tmp[32] = {0};
if (S_OK != StringCchPrintf(tmp, 32, L"%g", defvalue)) return defvalue;
const wchar_t *ret = ReadStringW(section, name, tmp);
return _wtof(ret);
}
const char* ConfigW::ReadStringA(const wchar_t *section, const wchar_t *name, const char *defvalue)
{
if (buffA) free(buffA);
if (!fileName) return defvalue;
int len = (int)strlen(defvalue) + 1;
wchar_t *tmp = (wchar_t*)malloc(len *sizeof(wchar_t));
if (!tmp) return defvalue;
if (!MultiByteToWideCharSZ(CP_ACP, 0, defvalue, -1, tmp, len))
{
free(tmp);
return defvalue;
}
const wchar_t *ret = ReadStringW(section, name, tmp);
if (!ret || lstrcmp(ret, tmp) == 0)
{
free(tmp);
return defvalue;
}
free(tmp);
len = (int)lstrlen(ret) + 1;
buffA = (char*)malloc(len*sizeof(char));
if (!buffA) return defvalue;
if (WideCharToMultiByteSZ(CP_ACP, 0, ret, -1, buffA, len, NULL, NULL))
{
free(buffA);
buffA = NULL;
return defvalue;
}
return buffA;
}
const wchar_t* ConfigW::ReadStringW(const wchar_t *section, const wchar_t *name, const wchar_t *defvalue)
{
if (!fileName) return defvalue;
static wchar_t def[] = L"_$~$_";
buff[0] = 0;
int len = GetPrivateProfileString(section, name, def, buff, BUFF_SIZE, fileName);
if (!len || !lstrcmp(def,buff)) return defvalue;
buff[BUFF_SIZE-1]=0;
return buff;
}
int ConfigW::ReadInt(const wchar_t *name, int defvalue)
{
if(!defSection) return defvalue;
return ReadInt(defSection, name, defvalue);
}
long long ConfigW::ReadInt64(const wchar_t *name, long long defvalue)
{
if(!defSection) return defvalue;
return ReadInt64(defSection, name, defvalue);
}
double ConfigW::ReadDouble(const wchar_t *name, double defvalue)
{
if(!defSection) return defvalue;
return ReadDouble(defSection, name, defvalue);
}
const char* ConfigW::ReadStringA(const wchar_t *name, const char *defvalue)
{
if(!defSection) return defvalue;
return ReadStringA(defSection, name, defvalue);
}
const wchar_t* ConfigW::ReadStringW(const wchar_t *name, const wchar_t *defvalue)
{
if(!defSection) return defvalue;
return ReadStringW(defSection, name, defvalue);
}
BOOL ConfigW::SetSection(const wchar_t *section)
{
if (defSection)
{
free(defSection);
defSection = NULL;
}
size_t len;
len = lstrlen(section) + 1;
defSection = (wchar_t*)malloc(len*sizeof(wchar_t));
if (NULL == defSection)
{
return FALSE;
}
if (S_OK != StringCchCopy(defSection, len, section))
{
free(defSection);
defSection = NULL;
return FALSE;
}
return TRUE;
}
BOOL ConfigW::SetIniFile(const wchar_t *file)
{
if (fileName)
{
if (emptyBOM) RemoveEmptyFile();
free(fileName);
fileName = NULL;
}
size_t len;
len = lstrlen(file) + 1;
fileName = (wchar_t*)malloc(len*sizeof(wchar_t));
if (NULL == fileName) return FALSE;
if (S_OK != StringCchCopy(fileName, len, file))
{
free(fileName);
fileName = NULL;
return FALSE;
}
if (fileName) CreateFileWithBOM();
return TRUE;
}
const wchar_t* ConfigW::GetSection(void)
{
return defSection;
}
const wchar_t* ConfigW::GetFile(void)
{
return fileName;
}
void ConfigW::CreateFileWithBOM(void)
{
// benski> this doesn't seem to be working on win9x
HANDLE hFile = CreateFile(fileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (INVALID_HANDLE_VALUE == hFile)
{
WORD wBOM = 0xFEFF;
DWORD num = 0;
hFile = CreateFile(fileName, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
WriteFile(hFile, &wBOM, sizeof(WORD), &num, NULL);
emptyBOM = TRUE;
}
CloseHandle(hFile);
}
void ConfigW::RemoveEmptyFile(void)
{
emptyBOM = FALSE;
HANDLE hFile = CreateFile(fileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (INVALID_HANDLE_VALUE == hFile) return;
DWORD fsize;
fsize = GetFileSize(hFile, NULL);
CloseHandle(hFile);
if (fsize == 2) DeleteFile(fileName);
return;
}
BOOL ConfigW::IsFileExist(void)
{
HANDLE hFile = CreateFile(fileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
BOOL exist = (INVALID_HANDLE_VALUE != hFile);
if (exist)
{
exist = (GetFileSize(hFile, NULL) != 2);
CloseHandle(hFile);
}
return exist;
}
+62
View File
@@ -0,0 +1,62 @@
#ifndef NULLSOFT_CONFIG_H_
#define NULLSOFT_CONFIG_H_
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#define BUFF_SIZE 8192
class ConfigW
{
public:
ConfigW();
ConfigW(const wchar_t *ini, const wchar_t *section);
~ConfigW();
public:
void Flush(void);
BOOL Write(const wchar_t *name, double value);
BOOL Write(const wchar_t *section, const wchar_t *name, double value);
BOOL Write(const wchar_t *name, long long value);
BOOL Write(const wchar_t *section, const wchar_t *name, long long value);
BOOL Write(const wchar_t *name, int value);
BOOL Write(const wchar_t *section, const wchar_t *name, int value);
BOOL Write(const wchar_t *name, const wchar_t *value);
BOOL Write(const wchar_t *section, const wchar_t *name, const wchar_t *value);
BOOL Write(const wchar_t *name, const char value);
BOOL Write(const wchar_t *section, const wchar_t *name, const char *value);
int ReadInt(const wchar_t *name, int defvalue);
long long ReadInt64(const wchar_t *name, long long defvalue);
double ReadDouble(const wchar_t *name, double defvalue);
const char* ReadStringA(const wchar_t *name, const char *defvalue);
const wchar_t* ReadStringW(const wchar_t *name, const wchar_t *defvalue);
int ReadInt(const wchar_t *section, const wchar_t *name, int defvalue);
long long ReadInt64(const wchar_t *section, const wchar_t *name, long long defvalue);
double ReadDouble(const wchar_t *section, const wchar_t *name, double defvalue);
const char* ReadStringA(const wchar_t *section, const wchar_t *name, const char *defvalue);
const wchar_t* ReadStringW(const wchar_t *section, const wchar_t *name, const wchar_t *defvalue);
BOOL SetSection(const wchar_t *section);
BOOL SetIniFile(const wchar_t *file);
BOOL IsFileExist(void);
const wchar_t* GetSection(void);
const wchar_t* GetFile(void);
private:
HANDLE CreateFileHandle();
void CreateFileWithBOM(void);
void RemoveEmptyFile(void);
private:
BOOL emptyBOM;
wchar_t buff[BUFF_SIZE];
char *buffA;
wchar_t *fileName;
wchar_t *defSection;
};
#endif //NULLSOFT_CONFIG_H_
@@ -0,0 +1,457 @@
#include ".\configdlg.h"
#include ".\smtpdlg.h"
#include ".\resource.h"
#include <shlobj.h>
#include ".\miniVersion.h"
#include ".\getwinver.h"
#include ".\settings.h"
#include ".\minidump.h"
#include ".\main.h"
#include <strsafe.h>
#include "api__gen_crasher.h"
extern Settings settings;
BOOL CALLBACK ConfigDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static wchar_t *path;
switch (uMsg)
{
case WM_INITDIALOG:
{
HWND hwCombo = GetDlgItem(hwndDlg, IDC_CMB_DMPTYPE);
// detect windows version
wchar_t strBuff[2048] = {0}, winVer[32] = {0}, build[32] = {0};
int nWinVer = 0;
GetWinVer(winVer, &nWinVer, build);
StringCchPrintf(strBuff, 2048, L"%s (%s)", winVer, build);
SetWindowText(GetDlgItem(hwndDlg, IDC_LBL_OSVERSION), strBuff);
// discover dbghlp.dll
HMODULE hm = NULL;
// first in app folder
if (GetModuleFileName( NULL, strBuff, _MAX_PATH ))
{
wchar_t *pSlash = wcsrchr( strBuff, L'\\' );
if (pSlash)
{
StringCchCopy(pSlash+1, 2048 - (pSlash + 1 - strBuff), L"dbghelp.dll" );
hm = LoadLibraryW( strBuff );
}
}
if (!hm)
{
// load any version we can
hm = LoadLibraryW(L"dbghelp.dll");
}
if (hm)
{
GetModuleFileName(hm, strBuff, 2048);
SetWindowText(GetDlgItem(hwndDlg, IDC_LBL_DLLPATH), strBuff);
// try to get dll version
CMiniVersion ver(strBuff);
if(ver.Init())
{
WORD dwBuf[4] = {0};
ver.GetProductVersion(dwBuf);
StringCchPrintf(strBuff, 2048, L"%d.%d.%d.%d", dwBuf[0], dwBuf[1], dwBuf[2], dwBuf[3]);
}
else
{
WASABI_API_LNGSTRINGW_BUF(IDS_UNABLE_TO_LOAD, strBuff, 128);
}
ver.Release();
BOOL (WINAPI* MiniDumpWriteDump)(
HANDLE hProcess,
DWORD ProcessId,
HANDLE hFile,
MINIDUMP_TYPE DumpType,
PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
PMINIDUMP_EXCEPTION_INFORMATION UserStreamParam,
PMINIDUMP_EXCEPTION_INFORMATION CallbackParam
) = NULL;
*(FARPROC*)&MiniDumpWriteDump = GetProcAddress(hm, "MiniDumpWriteDump");
wchar_t temp[256] = {0};
StringCchPrintfW(temp, 256, L"%s [%s]", strBuff, WASABI_API_LNGSTRINGW(MiniDumpWriteDump ? IDS_LOADED_OK : IDS_UNABLE_TO_LOAD));
SetDlgItemText(hwndDlg, IDC_LBL_DLLVERSION, temp);
FreeLibrary(hm);
}
else
{
SetWindowText(GetDlgItem(hwndDlg, IDC_LBL_DLLPATH), WASABI_API_LNGSTRINGW(IDS_NOT_FOUND));
wchar_t temp[256] = {0}, temp2[128] = {0};
StringCchPrintfW(temp, 256, L"%s [%s]", WASABI_API_LNGSTRINGW(IDS_UNKNOWN), WASABI_API_LNGSTRINGW_BUF(IDS_UNABLE_TO_LOAD, temp2, 128));
SetWindowText(GetDlgItem(hwndDlg, IDC_LBL_DLLVERSION), temp);
}
// set combobox with values
WPARAM pos;
pos = SendMessage(hwCombo, CB_ADDSTRING, 0, (LPARAM) L"MiniDumpNormal");
SendMessage(hwCombo, CB_SETITEMDATA, pos, 0x00000000);
pos = SendMessage(hwCombo, CB_ADDSTRING, 0, (LPARAM) L"MiniDumpWithDataSegs");
SendMessage(hwCombo, CB_SETITEMDATA, pos, 0x00000001);
pos = SendMessage(hwCombo, CB_ADDSTRING, 0, (LPARAM) L"MiniDumpWithFullMemory");
SendMessage(hwCombo, CB_SETITEMDATA, pos, 0x00000002);
pos = SendMessage(hwCombo, CB_ADDSTRING, 0, (LPARAM) L"MiniDumpWithHandleData (Not Supported: Windows Me/98/95)");
SendMessage(hwCombo, CB_SETITEMDATA, pos, 0x00000004);
pos = SendMessage(hwCombo, CB_ADDSTRING, 0, (LPARAM) L"MiniDumpFilterMemory");
SendMessage(hwCombo, CB_SETITEMDATA, pos, 0x00000008);
pos = SendMessage(hwCombo, CB_ADDSTRING, 0, (LPARAM) L"MiniDumpScanMemory");
SendMessage(hwCombo, CB_SETITEMDATA, pos, 0x00000010);
pos = SendMessage(hwCombo, CB_ADDSTRING, 0, (LPARAM) L"MiniDumpWithUnloadedModules (Not Supported: DbgHelp 5.1 and earlier)");
SendMessage(hwCombo, CB_SETITEMDATA, pos, 0x00000020);
pos = SendMessage(hwCombo, CB_ADDSTRING, 0, (LPARAM) L"MiniDumpWithIndirectlyReferencedMemory (Not Supported: DbgHelp 5.1 and earlier)");
SendMessage(hwCombo, CB_SETITEMDATA, pos, 0x00000040);
pos = SendMessage(hwCombo, CB_ADDSTRING, 0, (LPARAM) L"MiniDumpFilterModulePaths (Not Supported: DbgHelp 5.1 and earlier)");
SendMessage(hwCombo, CB_SETITEMDATA, pos, 0x00000080);
pos = SendMessage(hwCombo, CB_ADDSTRING, 0, (LPARAM) L"MiniDumpWithProcessThreadData (Not Supported: DbgHelp 5.1 and earlier)");
SendMessage(hwCombo, CB_SETITEMDATA, pos, 0x00000100);
pos = SendMessage(hwCombo, CB_ADDSTRING, 0, (LPARAM) L"MiniDumpWithPrivateReadWriteMemory (Not Supported: DbgHelp 5.1 and earlier)");
SendMessage(hwCombo, CB_SETITEMDATA, pos, 0x00000200);
pos = SendMessage(hwCombo, CB_ADDSTRING, 0, (LPARAM) L"MiniDumpWithoutOptionalData (Not Supported: DbgHelp 6.1 and earlier)");
SendMessage(hwCombo, CB_SETITEMDATA, pos, 0x00000400);
pos = SendMessage(hwCombo, CB_ADDSTRING, 0, (LPARAM) L"MiniDumpWithFullMemoryInfo (Not Supported: DbgHelp 6.1 and earlier)");
SendMessage(hwCombo, CB_SETITEMDATA, pos, 0x00000800);
pos = SendMessage(hwCombo, CB_ADDSTRING, 0, (LPARAM) L"MiniDumpWithThreadInfo (Not Supported: DbgHelp 6.1 and earlier)");
SendMessage(hwCombo, CB_SETITEMDATA, pos, 0x00001000);
pos = SendMessage(hwCombo, CB_ADDSTRING, 0, (LPARAM) L"MiniDumpWithCodeSegs (Not Supported: DbgHelp 6.1 and earlier)");
SendMessage(hwCombo, CB_SETITEMDATA, pos, 0x00002000);
// read settings
settings.Load();
CheckDlgButton(hwndDlg, IDC_CHK_CREATELOG, settings.createLOG);
CheckDlgButton(hwndDlg, IDC_CHK_CREATEDMP, settings.createDMP);
CheckDlgButton(hwndDlg, IDC_CHK_RESTART, settings.autoRestart);
CheckDlgButton(hwndDlg, IDC_CHK_SILENT, settings.silentMode);
CheckDlgButton(hwndDlg, IDC_CHK_SEND, settings.sendData);
CheckDlgButton(hwndDlg, IDC_CHK_COMPRESS, settings.zipData);
CheckDlgButton(hwndDlg, IDC_RB_USECLIENT, settings.sendByClient);
CheckDlgButton(hwndDlg, IDC_RB_USESMTP, settings.sendBySMTP);
CreatePathFromFullName(&path, settings.zipPath);
SetWindowText(GetDlgItem(hwndDlg, IDC_EDT_PATH), path);
SetWindowText(GetDlgItem(hwndDlg, IDC_EDT_ZIPNAME), GetFileName(settings.zipPath));
SelectComboBoxItem(hwCombo, settings.dumpType);
SetWindowText(GetDlgItem(hwndDlg, IDC_EDT_DMPPATH), GetFileName(settings.dumpPath));
CheckDlgButton(hwndDlg, IDC_CHK_LOGSYSTEM, settings.logSystem);
CheckDlgButton(hwndDlg, IDC_CHK_LOGREGISTRY, settings.logRegistry);
CheckDlgButton(hwndDlg, IDC_CHK_LOGSTACK, settings.logStack);
CheckDlgButton(hwndDlg, IDC_CHK_LOGMODULE, settings.logModule);
SetWindowText(GetDlgItem(hwndDlg, IDC_EDT_LOGPATH), GetFileName(settings.logPath));
UpdateSend(hwndDlg, settings.sendData);
UpdateZip(hwndDlg, settings.zipData);
UpdateCreateDmp(hwndDlg, settings.createDMP);
UpdateCreateLog(hwndDlg, settings.createLOG);
}
break;
case WM_DESTROY:
{
wchar_t buf[1024] = {0};
int len, pathlen;
HWND hwCombo;
settings.createLOG = (SendMessage(GetDlgItem(hwndDlg, IDC_CHK_CREATELOG), BM_GETCHECK, 0,0) == BST_CHECKED);
settings.createDMP = (SendMessage(GetDlgItem(hwndDlg, IDC_CHK_CREATEDMP), BM_GETCHECK, 0,0) == BST_CHECKED);
settings.autoRestart = (SendMessage(GetDlgItem(hwndDlg, IDC_CHK_RESTART), BM_GETCHECK, 0,0) == BST_CHECKED);
settings.silentMode = (SendMessage(GetDlgItem(hwndDlg, IDC_CHK_SILENT), BM_GETCHECK, 0,0) == BST_CHECKED);
settings.sendData = (SendMessage(GetDlgItem(hwndDlg, IDC_CHK_SEND), BM_GETCHECK, 0,0) == BST_CHECKED);
settings.sendByClient = (SendMessage(GetDlgItem(hwndDlg, IDC_RB_USECLIENT), BM_GETCHECK, 0,0) == BST_CHECKED);
settings.sendBySMTP = !settings.sendByClient;
settings.zipData = (SendMessage(GetDlgItem(hwndDlg, IDC_CHK_COMPRESS), BM_GETCHECK, 0,0) == BST_CHECKED);
len = GetWindowText(GetDlgItem(hwndDlg, IDC_EDT_PATH), buf, 1024);
if (path) free(path);
path = NULL;
if (len)
{
int cpyLen;
path = (wchar_t*)malloc((len +1)*2);
cpyLen = (buf[len-1] == L'\\') ? len -1: len;
StringCchCopyN(path, len + 1, buf, cpyLen);
}
pathlen = (path) ? (int)lstrlen(path) + 1 : 0;
if (settings.zipPath) free(settings.zipPath);
settings.zipPath = NULL;
len = GetWindowText(GetDlgItem(hwndDlg, IDC_EDT_ZIPNAME), buf, 1024);
if (len)
{
if (pathlen)
{
len += pathlen;
settings.zipPath = (wchar_t*)malloc((len + 1)*2);
StringCchPrintf(settings.zipPath, len+1, L"%s\\%s", path, buf);
}
else
{
settings.zipPath = (wchar_t*)malloc((len + 1)*2);
StringCchCopy(settings.zipPath, len+1, buf);
}
}
else // because path is based on the zipPath just write path
{
if (pathlen)
{
len = pathlen;
settings.zipPath = (wchar_t*)malloc((len + 1)*2);
StringCchPrintf(settings.zipPath, len+1, L"%s\\", path);
}
}
hwCombo = GetDlgItem(hwndDlg, IDC_CMB_DMPTYPE);
settings.dumpType = (int) SendMessage(hwCombo, CB_GETITEMDATA, SendMessage(hwCombo, CB_GETCURSEL, 0, 0), 0);
if (settings.dumpPath) free(settings.dumpPath);
settings.dumpPath = NULL;
len = GetWindowText(GetDlgItem(hwndDlg, IDC_EDT_DMPNAME), buf, 1024);
if (len)
{
if (pathlen)
{
len += pathlen;
settings.dumpPath = (wchar_t*)malloc((len + 1)*2);
StringCchPrintf(settings.dumpPath, len+1, L"%s\\%s", path, buf);
}
else
{
settings.dumpPath = (wchar_t*)malloc((len + 1)*2);
StringCchCopy(settings.dumpPath, len+1, buf);
}
}
settings.logSystem = (SendMessage(GetDlgItem(hwndDlg, IDC_CHK_LOGSYSTEM), BM_GETCHECK, 0,0) == BST_CHECKED);
settings.logRegistry = (SendMessage(GetDlgItem(hwndDlg, IDC_CHK_LOGREGISTRY), BM_GETCHECK, 0,0) == BST_CHECKED);
settings.logStack = (SendMessage(GetDlgItem(hwndDlg, IDC_CHK_LOGSTACK), BM_GETCHECK, 0,0) == BST_CHECKED);
settings.logModule = (SendMessage(GetDlgItem(hwndDlg, IDC_CHK_LOGMODULE), BM_GETCHECK, 0,0) == BST_CHECKED);
if (settings.logPath) free(settings.logPath);
settings.logPath = NULL;
len = GetWindowText(GetDlgItem(hwndDlg, IDC_EDT_LOGNAME), buf, 1024);
if (len)
{
if (pathlen)
{
len += pathlen;
settings.logPath = (wchar_t*)malloc((len + 1)*2);
StringCchPrintf(settings.logPath, len+1, L"%s\\%s", path, buf);
}
else
{
settings.logPath = (wchar_t*)malloc((len + 1)*2);
StringCchCopy(settings.logPath, len+1, buf);
}
}
if (!settings.Save())
{
wchar_t title[32] = {0};
MessageBox(NULL, WASABI_API_LNGSTRINGW(IDS_UNABLE_TO_SAVE_SETTINGS),
WASABI_API_LNGSTRINGW_BUF(IDS_SAVE_ERROR,title,32), MB_OK);
}
if(path) free(path);
path = NULL;
break;
}
case WM_COMMAND:
int ctrl = LOWORD(wParam);
switch (ctrl)
{
case IDC_CHK_CREATELOG:
case IDC_CHK_CREATEDMP:
case IDC_CHK_SEND:
case IDC_CHK_COMPRESS:
if (HIWORD(wParam) == BN_CLICKED)
{
BOOL enabled = (SendMessage((HWND) lParam, BM_GETCHECK, 0,0) == BST_CHECKED);
if (ctrl == IDC_CHK_CREATELOG) UpdateCreateLog(hwndDlg, enabled);
else if (ctrl == IDC_CHK_CREATEDMP) UpdateCreateDmp(hwndDlg, enabled);
else if (ctrl == IDC_CHK_SEND) UpdateSend(hwndDlg, enabled);
else if (ctrl == IDC_CHK_COMPRESS) UpdateZip(hwndDlg, enabled);
}
break;
case IDC_RB_USESMTP:
case IDC_RB_USECLIENT:
if (HIWORD(wParam) == BN_CLICKED) UpdateSendType(hwndDlg, (ctrl == IDC_RB_USESMTP));
break;
case IDC_BTN_PATH:
{
wchar_t szFile[2048] = {0}; // buffer for file name
GetWindowText(GetDlgItem(hwndDlg, IDC_EDT_PATH), szFile, 2048);
if (OpenFolderDialog(NULL, szFile))SetWindowText(GetDlgItem(hwndDlg, IDC_EDT_PATH), szFile);
}
break;
case IDC_BTN_SMTP:
WASABI_API_DIALOGBOXW(IDD_DLG_SMTP, hwndDlg, (DLGPROC)smtpDlgProc);
break;
}
break;
}
//settings.smtpUser;
return FALSE;
}
int SelectComboBoxItem(const HWND hwCombo, int data)
{
int count = (int) SendMessage(hwCombo, CB_GETCOUNT , 0, 0);
for (int i = 0; i < count; i++)
{
if (data == (int) SendMessage(hwCombo, CB_GETITEMDATA, i, 0))
return (int) SendMessage(hwCombo, CB_SETCURSEL, i, 0);
}
return -1;
}
void UpdateZip(HWND hwndDlg, BOOL enabled)
{
EnableWindow(GetDlgItem(hwndDlg, IDC_GRP_ZIP), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_ZIPNAME), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_ZIPNAME), enabled);
}
void UpdateSendType(HWND hwndDlg, BOOL enabled)
{
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_SMTP), enabled);
}
void UpdateSend(HWND hwndDlg, BOOL enabled)
{
EnableWindow(GetDlgItem(hwndDlg, IDC_RB_USECLIENT), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_RB_USESMTP), enabled);
BOOL stmpPressed = (SendMessage(GetDlgItem(hwndDlg,IDC_RB_USESMTP), BM_GETCHECK, 0,0) == BST_CHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_SMTP), enabled && stmpPressed);
}
void UpdateCreateDmp(HWND hwndDlg, BOOL enabled)
{
EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_OSVERSION_CAPTION), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_DLLPATH_CAPTION), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_DLLVERSION_CAPTION), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_OSVERSION), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_DLLPATH), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_DLLVERSION), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_DMPTYPE), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_CMB_DMPTYPE), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_DMPNAME), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_DMPNAME), enabled);
}
void UpdateCreateLog(HWND hwndDlg, BOOL enabled)
{
EnableWindow(GetDlgItem(hwndDlg, IDC_GRP_LOG), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_LOGSYSTEM), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_LOGREGISTRY), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_LOGSTACK), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_LOGMODULE), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_LOGNAME), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_LOGNAME), enabled);
}
BOOL CALLBACK browseEnumProc(HWND hwnd, LPARAM lParam)
{
wchar_t cl[32] = {0};
GetClassNameW(hwnd, cl, ARRAYSIZE(cl));
if (!lstrcmpiW(cl, WC_TREEVIEW))
{
PostMessage(hwnd, TVM_ENSUREVISIBLE, 0, (LPARAM)TreeView_GetSelection(hwnd));
return FALSE;
}
return TRUE;
}
static int CALLBACK WINAPI BrowseCallbackProc( HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
{
switch (uMsg)
{
case BFFM_INITIALIZED:
{
//SetWindowText(hwnd, getString(IDS_P_SELECT_LANGDIR,NULL,0));
SendMessage(hwnd, BFFM_SETSELECTION, 1, (LPARAM)lpData);
// this is not nice but it fixes the selection not working correctly on all OSes
EnumChildWindows(hwnd, browseEnumProc, 0);
}
return 0;
}
return 0;
}
BOOL OpenFolderDialog(HWND parent, LPWSTR pathBuffer)
{
if (!pathBuffer) return FALSE;
// Return value for the function
BOOL ret = TRUE;
// Set up the params
BROWSEINFO browseInfo = {0};
browseInfo.hwndOwner = parent;
browseInfo.lpfn = BrowseCallbackProc;
browseInfo.lParam = (LPARAM)pathBuffer;
browseInfo.lpszTitle = WASABI_API_LNGSTRINGW(IDS_SELECT_FOLDER_FOR_ERROR_INFO);
browseInfo.ulFlags = BIF_NEWDIALOGSTYLE;
// Show the dialog
LPITEMIDLIST itemIDList = SHBrowseForFolder(&browseInfo);
// Did user press cancel?
if (!itemIDList)
ret = FALSE;
// Is everything so far?
if (ret != FALSE)
{
// Get the path from the returned ITEMIDLIST
if (!SHGetPathFromIDList(itemIDList, pathBuffer))
ret = FALSE;
// Now we need to free the ITEMIDLIST the shell allocated
LPMALLOC shellMalloc;
HRESULT hr;
// Get pointer to the shell's malloc interface
hr = SHGetMalloc(&shellMalloc);
// Did it work?
if (SUCCEEDED(hr))
{
shellMalloc->Free(itemIDList);
shellMalloc->Release();
ret = TRUE;
}
}
return ret;
}
void CreatePathFromFullName(wchar_t **path, const wchar_t *fullname)
{
if (*path) free(*path);
*path = NULL;
if (!fullname) return;
const wchar_t *end = wcsrchr(fullname, L'\\');
if (!end || end == fullname) return;
int len = (int)(end - fullname + 1);
if (len == 3) len++;
*path = (wchar_t*)malloc(len*2);
StringCchCopyN(*path, len, fullname, len -1);
}
const wchar_t* GetFileName(const wchar_t *fullname)
{
if (!fullname) return NULL;
const wchar_t *start = wcsrchr(fullname, L'\\');
if (start && start != fullname) start = CharNext(start);
return start;
}
@@ -0,0 +1,15 @@
#pragma once
#include <windows.h>
int SelectComboBoxItem(const HWND hwCombo, int data);
BOOL OpenFolderDialog(HWND parent, LPWSTR pathBuffer);
BOOL CALLBACK ConfigDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
void UpdateSendType(HWND hwndDlg, BOOL enabled);
void UpdateSend(HWND hwndDlg, BOOL enabled);
void UpdateCreateDmp(HWND hwndDlg, BOOL enabled);
void UpdateCreateLog(HWND hwndDlg, BOOL enabled);
void UpdateZip(HWND hwndDlg, BOOL enabled);
void CreatePathFromFullName(wchar_t **path, const wchar_t *fullname);
const wchar_t* GetFileName(const wchar_t *fullname);
@@ -0,0 +1,101 @@
#include ".\crashdlg.h"
#include ".\configdlg.h"
#include ".\resource.h"
#include ".\settings.h"
#include "exceptionhandler.h"
#include <strsafe.h>
extern Settings settings;
extern PEXCEPTION_POINTERS gExceptionInfo;
BOOL CALLBACK CrashDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
UNREFERENCED_PARAMETER(lParam);
switch (uMsg)
{
case WM_INITDIALOG:
{
// as we're loading things, make sure we've got a decent icon size to use in the second usage
HICON hIcon = (HICON)LoadImage(GetModuleHandle(NULL),MAKEINTRESOURCE(102),IMAGE_ICON,48,48,LR_SHARED);
SetClassLongPtr(hwndDlg, GCLP_HICON, (LONG_PTR)hIcon);
HWND hwndPrg = GetDlgItem(hwndDlg, IDC_PRG_COLLECT);
SendMessage(hwndPrg, PBM_SETRANGE, 0, MAKELPARAM(0,100));
SendMessage(hwndPrg, PBM_SETPOS, 0, 0);
// this will make sure that we've got the logo shown even when using a localised version
SendDlgItemMessage(hwndDlg,IDC_BMP_LOGO,STM_SETIMAGE,IMAGE_ICON,(LPARAM)hIcon);
SetDlgItemText(hwndDlg, IDC_LBL_STEP, L"Analyzing settings...");
settings.ClearTempData();
wchar_t waPath[2*_MAX_PATH] = {0};
if (GetModuleFileName( NULL, waPath, 2*_MAX_PATH ))
{
settings.WriteWinamp(waPath);
}
SetTimer(hwndDlg, 123, 1000, NULL);
break;
}
case WM_TIMER:
if (wParam == 123)
{
KillTimer(hwndDlg,wParam);
HWND hwndPrg = GetDlgItem(hwndDlg, IDC_PRG_COLLECT);
SetDlgItemText(hwndDlg, IDC_LBL_STEP, L"Generating log file...");
SendMessage(hwndPrg, PBM_SETPOS, 30, 0);
UpdateWindow(hwndDlg);
if (settings.createLOG) settings.WriteLogCollectResult(CreateLog(gExceptionInfo, L"Winamp"));
SetDlgItemText(hwndDlg, IDC_LBL_STEP, L"Generating dump file...");
SendMessage(hwndPrg, PBM_SETPOS, 50, 0);
UpdateWindow(hwndDlg);
if (settings.createDMP) settings.WriteDmpCollectResult(CreateDump(gExceptionInfo));
SetDlgItemText(hwndDlg, IDC_LBL_STEP, L"Starting error reporter...");
SendMessage(hwndPrg, PBM_SETPOS, 90, 0);
UpdateWindow(hwndDlg);
STARTUPINFO si = {0};
si.cb = sizeof(si);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_SHOW;
PROCESS_INFORMATION pi = {0};
wchar_t reporter[512] = {0}, waPlugPath[MAX_PATH] = {0}, cmd[512] = {0}, *waPath = 0;
GetModuleFileName( NULL, waPlugPath, MAX_PATH);
CreatePathFromFullName(&waPath, waPlugPath);
StringCchPrintf(reporter, 512, L"%s\\reporter.exe", waPath);
StringCchPrintf(cmd, 512, L" \"%s\"", settings.GetPath());
if (CreateProcess(
reporter, // name of executable module
cmd, // command line string
NULL, // process attributes
NULL, // thread attributes
FALSE, // handle inheritance option
0, // creation flags
NULL, // new environment block
NULL, // current directory name
&si, // startup information
&pi)) // process information
{
SetDlgItemText(hwndDlg, IDC_LBL_STEP, L"Done.");
SetTimer(hwndDlg, 126, 200, NULL);
}
else
{
SetDlgItemText(hwndDlg, IDC_LBL_STEP, L"Error. Unable to run reporter.");
SetTimer(hwndDlg, 126, 3000, NULL);
}
SendMessage(hwndPrg, PBM_SETPOS, 100, 0);
UpdateWindow(hwndDlg);
}
else if (wParam == 126)
{
KillTimer(hwndDlg,wParam);
DestroyWindow(hwndDlg);
}
break;
}
return FALSE;
}
@@ -0,0 +1,5 @@
#pragma once
#include <windows.h>
#include <commctrl.h>
BOOL CALLBACK CrashDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
@@ -0,0 +1,364 @@
// SendEmail.cpp Version 1.0
//
// Author: Hans Dietrich
// hdietrich2@hotmail.com
//
// This software is released into the public domain.
// You are free to use it in any way you like, except
// that you may not sell this source code.
//
// This software is provided "as is" with no expressed
// or implied warranty. I accept no liability for any
// damage or loss of business that this software may cause.
//
///////////////////////////////////////////////////////////////////////////////
// Notes on compiling: this does not use MFC. Set precompiled header
// option to "Not using precompiled headers".
//
// This code assumes that a default mail client has been set up.
#include ".\sendemail.h"
#include <crtdbg.h>
#include <io.h>
#pragma warning(disable: 4228)
#include <mapi.h>
#pragma warning(default: 4228)
#pragma warning(disable:4127) // for _ASSERTE
#ifndef _countof
#define _countof(array) (sizeof(array)/sizeof(array[0]))
#endif
BOOL SendEmail(HWND hWnd, // parent window, must not be NULL
LPCTSTR lpszTo, // must NOT be NULL or empty
LPCTSTR lpszToName, // may be NULL
LPCTSTR lpszSubject, // may be NULL
LPCTSTR lpszMessage, // may be NULL
LPCTSTR lpszAttachment) // may be NULL
{
_ASSERTE(lpszTo && lpszTo[0] != _T('\0'));
if (lpszTo == NULL || lpszTo[0] == _T('\0'))
return FALSE;
// ===== LOAD MAPI DLL =====
HMODULE hMapi = ::LoadLibraryA("MAPI32.DLL");
_ASSERTE(hMapi);
if (hMapi == NULL)
{
::MessageBox(NULL,
_T("Failed to load MAPI32.DLL."),
_T("CrashRep"),
MB_OK|MB_ICONSTOP);
return FALSE;
}
// get proc address for MAPISendMail
ULONG (PASCAL *lpfnSendMail)(ULONG, ULONG, MapiMessage*, FLAGS, ULONG);
(FARPROC&)lpfnSendMail = GetProcAddress(hMapi, "MAPISendMail");
_ASSERTE(lpfnSendMail);
if (lpfnSendMail == NULL)
{
::MessageBox(NULL,
_T("Invalid MAPI32.DLL, cannot find MAPISendMail."),
_T("CrashRep"),
MB_OK|MB_ICONSTOP);
::FreeLibrary(hMapi);
return FALSE;
}
// ===== SET UP MAPI STRUCTS =====
// ===== file description (for the attachment) =====
MapiFileDesc fileDesc;
memset(&fileDesc, 0, sizeof(fileDesc));
// ----- attachment path
TCHAR szTempName[_MAX_PATH*2];
memset(szTempName, 0, sizeof(szTempName));
if (lpszAttachment && lpszAttachment[0] != _T('\0'))
lstrcpyn(szTempName, lpszAttachment, _countof(szTempName)-2);
#ifdef _UNICODE
char szTempNameA[_MAX_PATH*2];
memset(szTempNameA, 0, sizeof(szTempNameA));
_wcstombsz(szTempNameA, szTempName, _countof(szTempNameA)-2);
#endif
// ----- attachment title
TCHAR szTitle[_MAX_PATH*2];
memset(szTitle, 0, sizeof(szTitle));
if (lpszAttachment && lpszAttachment[0] != _T('\0'))
lstrcpyn(szTitle, GetFilePart(lpszAttachment), _countof(szTitle)-2);
#ifdef _UNICODE
char szTitleA[_MAX_PATH*2];
memset(szTitleA, 0, sizeof(szTitleA));
_wcstombsz(szTitleA, szTitle, _countof(szTitleA)-2);
#endif
fileDesc.nPosition = (ULONG)-1;
#ifdef _UNICODE
fileDesc.lpszPathName = szTempNameA;
fileDesc.lpszFileName = szTitleA;
#else
fileDesc.lpszPathName = szTempName;
fileDesc.lpszFileName = szTitle;
#endif
// ===== recipient =====
MapiRecipDesc recip;
memset(&recip, 0, sizeof(recip));
// ----- name
TCHAR szRecipName[_MAX_PATH*2];
memset(szRecipName, 0, sizeof(szRecipName));
if (lpszToName && lpszToName[0] != _T('\0'))
lstrcpyn(szRecipName, lpszToName, _countof(szRecipName)-2);
#ifdef _UNICODE
char szRecipNameA[_MAX_PATH*2];
memset(szRecipNameA, 0, sizeof(szRecipNameA));
_wcstombsz(szRecipNameA, szRecipName, _countof(szRecipNameA)-2);
#endif
if (lpszToName && lpszToName[0] != _T('\0'))
{
#ifdef _UNICODE
recip.lpszName = szRecipNameA;
#else
recip.lpszName = szRecipName;
#endif
}
// ----- address
TCHAR szAddress[_MAX_PATH*2];
memset(szAddress, 0, sizeof(szAddress));
lstrcpyn(szAddress, lpszTo, _countof(szAddress)-2);
#ifdef _UNICODE
char szAddressA[_MAX_PATH*2];
memset(szAddressA, 0, sizeof(szAddressA));
_wcstombsz(szAddressA, szAddress, _countof(szAddressA)-2);
#endif
#ifdef _UNICODE
recip.lpszAddress = szAddressA;
#else
recip.lpszAddress = szAddress;
#endif
recip.ulRecipClass = MAPI_TO;
// ===== message =====
MapiMessage message;
memset(&message, 0, sizeof(message));
// ----- recipient
message.nRecipCount = 1;
message.lpRecips = &recip;
// ----- attachment
if (lpszAttachment && lpszAttachment[0] != _T('\0'))
{
message.nFileCount = 1;
message.lpFiles = &fileDesc;
}
// ----- subject
TCHAR szSubject[_MAX_PATH*2];
memset(szSubject, 0, sizeof(szSubject));
if (lpszSubject && lpszSubject[0] != _T('\0'))
lstrcpyn(szSubject, lpszSubject, _countof(szSubject)-2);
#ifdef _UNICODE
char szSubjectA[_MAX_PATH*2];
memset(szSubjectA, 0, sizeof(szSubjectA));
_wcstombsz(szSubjectA, szSubject, _countof(szSubjectA)-2);
#endif
if (lpszSubject && lpszSubject[0] != _T('\0'))
{
#ifdef _UNICODE
message.lpszSubject = szSubjectA;
#else
message.lpszSubject = szSubject;
#endif
}
// ----- message
// message may be large, so allocate buffer
TCHAR *pszMessage = NULL;
int nMessageSize = 0;
if (lpszMessage)
{
nMessageSize = lstrlen(lpszMessage);
if (nMessageSize > 0)
{
pszMessage = new TCHAR [nMessageSize + 10];
_ASSERTE(pszMessage);
memset(pszMessage, 0, nMessageSize + 10);
lstrcpy(pszMessage, lpszMessage);
}
}
char *pszMessageA = NULL;
#ifdef _UNICODE
if (nMessageSize > 0)
{
pszMessageA = new char [nMessageSize + 10];
_ASSERTE(pszMessageA);
memset(pszMessageA, 0, nMessageSize + 10);
}
_wcstombsz(pszMessageA, pszMessage, nMessageSize+2);
#endif
if (nMessageSize > 0)
{
#ifdef _UNICODE
message.lpszNoteText = pszMessageA;
#else
message.lpszNoteText = pszMessage;
#endif
}
// ===== SETUP FINISHED, READY TO SEND =====
// some extra precautions are required to use MAPISendMail as it
// tends to enable the parent window in between dialogs (after
// the login dialog, but before the send note dialog).
::SetCapture(hWnd);
::SetFocus(NULL);
::EnableWindow(hWnd, FALSE);
ULONG nError = lpfnSendMail(0,
(LPARAM)hWnd,
&message,
MAPI_LOGON_UI | MAPI_DIALOG,
0);
#ifdef _DEBUG
TCHAR *cp = NULL;
switch (nError)
{
case SUCCESS_SUCCESS: cp = _T("SUCCESS_SUCCESS"); break;
case MAPI_E_USER_ABORT: cp = _T("MAPI_E_USER_ABORT"); break;
case MAPI_E_FAILURE: cp = _T("MAPI_E_FAILURE"); break;
case MAPI_E_LOGON_FAILURE: cp = _T("MAPI_E_LOGON_FAILURE"); break;
case MAPI_E_DISK_FULL: cp = _T("MAPI_E_DISK_FULL"); break;
case MAPI_E_INSUFFICIENT_MEMORY: cp = _T("MAPI_E_INSUFFICIENT_MEMORY"); break;
case MAPI_E_ACCESS_DENIED: cp = _T("MAPI_E_ACCESS_DENIED"); break;
case MAPI_E_TOO_MANY_SESSIONS: cp = _T("MAPI_E_TOO_MANY_SESSIONS"); break;
case MAPI_E_TOO_MANY_FILES: cp = _T("MAPI_E_TOO_MANY_FILES"); break;
case MAPI_E_TOO_MANY_RECIPIENTS: cp = _T("MAPI_E_TOO_MANY_RECIPIENTS"); break;
case MAPI_E_ATTACHMENT_NOT_FOUND: cp = _T("MAPI_E_ATTACHMENT_NOT_FOUND"); break;
case MAPI_E_ATTACHMENT_OPEN_FAILURE: cp = _T("MAPI_E_ATTACHMENT_OPEN_FAILURE"); break;
case MAPI_E_ATTACHMENT_WRITE_FAILURE: cp = _T("MAPI_E_ATTACHMENT_WRITE_FAILURE"); break;
case MAPI_E_UNKNOWN_RECIPIENT: cp = _T("MAPI_E_UNKNOWN_RECIPIENT"); break;
case MAPI_E_BAD_RECIPTYPE: cp = _T("MAPI_E_BAD_RECIPTYPE"); break;
case MAPI_E_NO_MESSAGES: cp = _T("MAPI_E_NO_MESSAGES"); break;
case MAPI_E_INVALID_MESSAGE: cp = _T("MAPI_E_INVALID_MESSAGE"); break;
case MAPI_E_TEXT_TOO_LARGE: cp = _T("MAPI_E_TEXT_TOO_LARGE"); break;
case MAPI_E_INVALID_SESSION: cp = _T("MAPI_E_INVALID_SESSION"); break;
case MAPI_E_TYPE_NOT_SUPPORTED: cp = _T("MAPI_E_TYPE_NOT_SUPPORTED"); break;
case MAPI_E_AMBIGUOUS_RECIPIENT: cp = _T("MAPI_E_AMBIGUOUS_RECIPIENT"); break;
case MAPI_E_MESSAGE_IN_USE: cp = _T("MAPI_E_MESSAGE_IN_USE"); break;
case MAPI_E_NETWORK_FAILURE: cp = _T("MAPI_E_NETWORK_FAILURE"); break;
case MAPI_E_INVALID_EDITFIELDS: cp = _T("MAPI_E_INVALID_EDITFIELDS"); break;
case MAPI_E_INVALID_RECIPS: cp = _T("MAPI_E_INVALID_RECIPS"); break;
case MAPI_E_NOT_SUPPORTED: cp = _T("MAPI_E_NOT_SUPPORTED"); break;
default: cp = _T("unknown error"); break;
}
if (nError == SUCCESS_SUCCESS)
{
OutputDebugString(_T("MAPISendMail ok\r\n"));
}
else
{
OutputDebugString(L"ERROR - MAPISendMail failed: ");
OutputDebugString(cp);
OutputDebugString(L"\r\n");
}
#endif // _DEBUG
// ===== SEND COMPLETE, CLEAN UP =====
// after returning from the MAPISendMail call, the window must be
// re-enabled and focus returned to the frame to undo the workaround
// done before the MAPI call.
::ReleaseCapture();
::EnableWindow(hWnd, TRUE);
::SetActiveWindow(NULL);
::SetActiveWindow(hWnd);
::SetFocus(hWnd);
if (pszMessage)
delete [] pszMessage;
pszMessage = NULL;
if (pszMessageA)
delete [] pszMessageA;
pszMessageA = NULL;
if (hMapi)
::FreeLibrary(hMapi);
hMapi = NULL;
BOOL bRet = TRUE;
if (nError != SUCCESS_SUCCESS) // &&
//nError != MAPI_USER_ABORT &&
//nError != MAPI_E_LOGIN_FAILURE)
{
bRet = FALSE;
}
return bRet;
}
const wchar_t* GetFilePart(LPCWSTR lpszFile)
{
const wchar_t *result = wcsrchr(lpszFile, _T('\\'));
if (result)
result++;
else
result = (wchar_t *) lpszFile;
return result;
}
int xwcstombsz(char* mbstr, const wchar_t* wcstr, size_t count)
{
if (count == 0 && mbstr != NULL)
return 0;
int result = ::WideCharToMultiByte(CP_ACP, 0, wcstr, -1,
mbstr, (int)count, NULL, NULL);
_ASSERTE(mbstr == NULL || result <= (int)count);
if (result > 0)
mbstr[result-1] = 0;
return result;
}
int xmbstowcsz(wchar_t* wcstr, const char* mbstr, size_t count)
{
if (count == 0 && wcstr != NULL)
return 0;
int result = ::MultiByteToWideChar(CP_ACP, 0, mbstr, -1,
wcstr, (int)count);
_ASSERTE(wcstr == NULL || result <= (int)count);
if (result > 0)
wcstr[result-1] = 0;
return result;
}
@@ -0,0 +1,38 @@
// SendEmail.h Version 1.0
//
// Author: Hans Dietrich
// hdietrich2@hotmail.com
//
// This software is released into the public domain.
// You are free to use it in any way you like, except
// that you may not sell this source code.
//
// This software is provided "as is" with no expressed
// or implied warranty. I accept no liability for any
// damage or loss of business that this software may cause.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef SENDEMAIL_H
#define SENDEMAIL_H
#include <tchar.h>
#include <windows.h>
const wchar_t* GetFilePart(LPCWSTR lpszFile);
BOOL SendEmail(HWND hWnd, // parent window, must not be NULL
LPCTSTR lpszTo, // must NOT be NULL or empty
LPCTSTR lpszToName, // may be NULL
LPCTSTR lpszSubject, // may be NULL
LPCTSTR lpszMessage, // may be NULL
LPCTSTR lpszAttachment); // may be NULL
#define _wcstombsz xwcstombsz
#define _mbstowcsz xmbstowcsz
int xwcstombsz(char* mbstr, const wchar_t* wcstr, size_t count);
int xmbstowcsz(wchar_t* wcstr, const char* mbstr, size_t count);
#endif //SENDEMAIL_H
@@ -0,0 +1,119 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
ICON_XP ICON "..\\..\\..\\..\\Winamp\\resource\\WinampIcon.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_DLG_SILENT DIALOGEX 0, 0, 187, 42
STYLE DS_SYSMODAL | DS_SETFONT | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "Winamp Error Reporter"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
ICON ICON_XP,IDC_STATIC,8,6,21,20,SS_REALSIZEIMAGE
LTEXT "",IDC_LBL_STEP,48,6,127,10
CONTROL "",IDC_PRG_COLLECT,"msctls_progress32",WS_BORDER,49,19,127,9
PUSHBUTTON "&Open Report Folder...",IDC_BUTTON1,47,21,87,13,NOT WS_VISIBLE
DEFPUSHBUTTON "&Close",IDC_BUTTON2,138,21,39,13,NOT WS_VISIBLE
END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""windows.h""\r\n"
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"#include ""version.rc2""\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_DLG_SILENT, DIALOG
BEGIN
BOTTOMMARGIN, 39
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// RT_MANIFEST
//
//The manifest is commented out because it is no longer needed (it was need for VC6 files)
//
//1 RT_MANIFEST "manifest.xml"
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#include "version.rc2"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
@@ -0,0 +1,30 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29424.173
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "feedback", "feedback.vcxproj", "{A845D04C-A95E-424C-BFA8-D7706DBA78BF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A845D04C-A95E-424C-BFA8-D7706DBA78BF}.Debug|Win32.ActiveCfg = Debug|Win32
{A845D04C-A95E-424C-BFA8-D7706DBA78BF}.Debug|Win32.Build.0 = Debug|Win32
{A845D04C-A95E-424C-BFA8-D7706DBA78BF}.Debug|x64.ActiveCfg = Debug|x64
{A845D04C-A95E-424C-BFA8-D7706DBA78BF}.Debug|x64.Build.0 = Debug|x64
{A845D04C-A95E-424C-BFA8-D7706DBA78BF}.Release|Win32.ActiveCfg = Release|Win32
{A845D04C-A95E-424C-BFA8-D7706DBA78BF}.Release|Win32.Build.0 = Release|Win32
{A845D04C-A95E-424C-BFA8-D7706DBA78BF}.Release|x64.ActiveCfg = Release|x64
{A845D04C-A95E-424C-BFA8-D7706DBA78BF}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2C383520-1961-4F68-B42C-3172B6341FB8}
EndGlobalSection
EndGlobal
@@ -0,0 +1,321 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="feedback"
ProjectGUID="{A845D04C-A95E-424C-BFA8-D7706DBA78BF}"
RootNamespace="feedback"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="."
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
PrecompiledHeaderThrough="precomp.h"
WarningLevel="3"
DebugInformationFormat="4"
ForcedIncludeFiles="precomp.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="comctl32.lib msvcrtd.lib libcpmtd.lib rpcrt4.lib"
OutputFile="$(ProgramFiles)\winamp\reporter.exe"
GenerateManifest="false"
IgnoreDefaultLibraryNames="libcmtd"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/feedback.pdb"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="manifest.xml"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfATL="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
FavorSizeOrSpeed="2"
AdditionalIncludeDirectories="."
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS"
StringPooling="true"
BufferSecurityCheck="false"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="precomp.h"
WarningLevel="3"
DebugInformationFormat="3"
ForcedIncludeFiles="precomp.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="comctl32.lib libcpmt.lib rpcrt4.lib"
OutputFile="$(ProgramFiles)\winamp\reporter.exe"
LinkIncremental="1"
GenerateManifest="false"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/$(ProjectName).pdb"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
EntryPointSymbol=""
RandomizedBaseAddress="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="manifest.xml"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\main.cpp"
>
</File>
<File
RelativePath=".\operations.cpp"
>
</File>
<File
RelativePath=".\precomp.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\silent.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\main.h"
>
</File>
<File
RelativePath=".\precomp.h"
>
</File>
<File
RelativePath=".\Resource.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath=".\feedback.rc"
>
</File>
<File
RelativePath=".\manifest.xml"
>
</File>
</Filter>
<Filter
Name="Settings"
>
<File
RelativePath="..\config.cpp"
>
</File>
<File
RelativePath="..\config.h"
>
</File>
<File
RelativePath="..\settings.cpp"
>
</File>
<File
RelativePath="..\settings.h"
>
</File>
</Filter>
<Filter
Name="zip"
>
<File
RelativePath=".\xzip\XZip.cpp"
>
</File>
<File
RelativePath=".\xzip\XZip.h"
>
</File>
</Filter>
<Filter
Name="smtp"
>
<File
RelativePath=".\smtp\Base64.cpp"
>
</File>
<File
RelativePath=".\smtp\Base64.h"
>
</File>
<File
RelativePath=".\smtp\Smtp.cpp"
>
</File>
<File
RelativePath=".\smtp\Smtp.h"
>
</File>
</Filter>
<Filter
Name="email"
>
<File
RelativePath=".\email\SendEmail.cpp"
>
</File>
<File
RelativePath=".\email\SendEmail.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
@@ -0,0 +1,253 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{A845D04C-A95E-424C-BFA8-D7706DBA78BF}</ProjectGuid>
<RootNamespace>feedback</RootNamespace>
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
<TargetName>reporter</TargetName>
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
<TargetName>reporter</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
<TargetName>reporter</TargetName>
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
<TargetName>reporter</TargetName>
</PropertyGroup>
<PropertyGroup Label="Vcpkg">
<VcpkgEnabled>false</VcpkgEnabled>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<VcpkgConfiguration>Debug</VcpkgConfiguration>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4091;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<Link>
<AdditionalDependencies>comctl32.lib;rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\
xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\ </Command>
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\'</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4091;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<Link>
<AdditionalDependencies>comctl32.lib;rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\
xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\ </Command>
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\'</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MinSpace</Optimization>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>None</DebugInformationFormat>
<DisableSpecificWarnings>4091;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<Link>
<AdditionalDependencies>comctl32.lib;rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\ </Command>
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\'</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<Optimization>MinSpace</Optimization>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>None</DebugInformationFormat>
<DisableSpecificWarnings>4091;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<Link>
<AdditionalDependencies>comctl32.lib;rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\ </Command>
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\'</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\config.cpp" />
<ClCompile Include="..\settings.cpp" />
<ClCompile Include="email\SendEmail.cpp" />
<ClCompile Include="main.cpp" />
<ClCompile Include="operations.cpp" />
<ClCompile Include="silent.cpp" />
<ClCompile Include="smtp\Base64.cpp" />
<ClCompile Include="smtp\Smtp.cpp" />
<ClCompile Include="xzip\XZip.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\config.h" />
<ClInclude Include="..\settings.h" />
<ClInclude Include="email\SendEmail.h" />
<ClInclude Include="main.h" />
<ClInclude Include="Resource.h" />
<ClInclude Include="smtp\Base64.h" />
<ClInclude Include="smtp\Smtp.h" />
<ClInclude Include="xzip\XZip.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="feedback.rc" />
</ItemGroup>
<ItemGroup>
<Xml Include="manifest.xml" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="smtp\Base64.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\config.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="operations.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="email\SendEmail.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\settings.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="silent.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="smtp\Smtp.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="xzip\XZip.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="smtp\Base64.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\config.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="main.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="email\SendEmail.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\settings.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="smtp\Smtp.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="xzip\XZip.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="Header Files">
<UniqueIdentifier>{de803cce-7a8d-46da-97a8-cb794b2ef154}</UniqueIdentifier>
</Filter>
<Filter Include="Ressource Files">
<UniqueIdentifier>{6cea30eb-0534-44ec-af7c-340d8047d962}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files">
<UniqueIdentifier>{a281ea66-f75c-47a9-90b7-61a031b4ea22}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="feedback.rc">
<Filter>Ressource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Xml Include="manifest.xml">
<Filter>Ressource Files</Filter>
</Xml>
</ItemGroup>
</Project>
@@ -0,0 +1,79 @@
// feedback.cpp : Defines the entry point for the application.
//
#include ".\main.h"
#include <commctrl.h>
#include <strsafe.h>
Settings settings;
int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpszCmdLine, int nCmdShow)
{
wchar_t *argv[2] = {0};
int argc = 0;
if (lpszCmdLine && wcslen(lpszCmdLine) >0) argc = ParseCommandLine(lpszCmdLine, NULL);
if (argc != 1)
{
MSGBOXPARAMSW msgbx = {sizeof(MSGBOXPARAMS),0};
msgbx.lpszText = L"Winamp Error Reporter\nCopyright © 2005-2014 Winamp SA";
msgbx.lpszCaption = L"About...";
msgbx.lpszIcon = MAKEINTRESOURCEW(ICON_XP);
msgbx.hInstance = GetModuleHandle(0);
msgbx.dwStyle = MB_USERICON;
MessageBoxIndirectW(&msgbx);
return 0;
}
ParseCommandLine(lpszCmdLine, argv);
settings.SetPath(argv[0]);
if (!settings.Load())
{
MessageBox(NULL, L"Unable to load settings.", L"Error", MB_OK);
return 0;
}
INITCOMMONCONTROLSEX icex = {sizeof(icex), ICC_WIN95_CLASSES};
InitCommonControlsEx(&icex);
DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_DLG_SILENT), NULL, (DLGPROC)SilentDlgProc, (LPARAM)hInstance);
return 0;
}
static int ParseCommandLine(wchar_t *cmdline, wchar_t **argv)
{
wchar_t *bufp;
int argc;
argc = 0;
for ( bufp = cmdline; *bufp; )
{
/* Skip leading whitespace */
while ( isspace(*bufp) ) ++bufp;
/* Skip over argument */
if ( *bufp == L'"' )
{
++bufp;
if ( *bufp )
{
if ( argv ) argv[argc] = bufp;
++argc;
}
/* Skip over word */
while ( *bufp && (*bufp != L'"') ) ++bufp;
}
else
{
if ( *bufp )
{
if ( argv ) argv[argc] = bufp;
++argc;
}
/* Skip over word */
while ( *bufp && ! isspace(*bufp) ) ++bufp;
}
if ( *bufp )
{
if ( argv ) *bufp = L'\0';
++bufp;
}
}
if ( argv ) argv[argc] = NULL;
return(argc);
}
@@ -0,0 +1,19 @@
#ifndef FEEDBACK_H
#define FEEDBACK_H
#include <windows.h>
#include "resource.h"
#include "..\settings.h"
extern Settings settings;
static int ParseCommandLine(wchar_t *cmdline, wchar_t **argv);
BOOL CALLBACK SilentDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
BOOL ZipData(void);
BOOL SendData(HWND hwnd);
BOOL Restart(void);
#endif FEEDBACK_H
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
<assemblyIdentity
version="1.11.0.0"
processorArchitecture="X86"
name="Nullsoft.Error Reporter"
type="win32"
/>
<description>Nullsoft Error Reporter</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
/>
</requestedPrivileges>
</security>
</trustInfo>
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>
@@ -0,0 +1,163 @@
#include ".\main.h"
#include ".\xzip\xzip.h"
#include ".\smtp\smtp.h"
#include ".\email\sendemail.h"
#include <strsafe.h>
const wchar_t* GetFileName(const wchar_t *fullname)
{
if (!fullname) return NULL;
const wchar_t *start = wcsrchr(fullname, L'\\');
if (start && start != fullname) start = CharNext(start);
return start;
}
BOOL ZipData(void)
{
BOOL retCode = FALSE;
HZIP hz = CreateZip(settings.zipPath, 0, ZIP_FILENAME);
if (hz)
{
retCode = TRUE;
if (settings.createLOG && settings.ReadLogCollectResult()) retCode = (ZR_OK == ZipAdd(hz, GetFileName(settings.logPath), settings.logPath, 0, ZIP_FILENAME));
if (retCode && settings.createDMP && settings.ReadDmpCollectResult()) retCode = (ZR_OK == ZipAdd(hz, GetFileName(settings.dumpPath), settings.dumpPath, 0, ZIP_FILENAME));
}
CloseZip(hz);
return retCode;
}
LPCTSTR BuildSubjectString(LPCTSTR subject)
{
static wchar_t subject_str[512] = {L"Winamp Error Report"};
wchar_t uid_str[64] = {0}, path[MAX_PATH] = {0};
if (GetModuleFileName(0, path, MAX_PATH))
{
PathRemoveFileSpec(path);
wchar_t *p = path + wcslen(path) - 1;
while(p && *p && *p != L'\\')
{
p = CharPrev(path, p);
}
if (p) *p = 0;
PathAppend(path, L"winamp.exe");
HKEY hkey = NULL;
if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Nullsoft\\Winamp", 0, 0, 0, KEY_READ, NULL, &hkey, NULL) == ERROR_SUCCESS)
{
DWORD s = 512, t = REG_SZ;
if (RegQueryValueEx(hkey, path, 0, &t, (LPBYTE)uid_str, &s) != ERROR_SUCCESS || t != REG_SZ) uid_str[0] = 0;
RegCloseKey(hkey);
}
}
// if it fails then we'll need to make something...
if (!uid_str[0])
{
GUID guid;
UuidCreate(&guid);
StringCbPrintf(uid_str, ARRAYSIZE(uid_str), L"%08X%04X%04X%02X%02X%02X%02X%02X%02X%02X%02X",
(int)guid.Data1, (int)guid.Data2, (int)guid.Data3, (int)guid.Data4[0],
(int)guid.Data4[1], (int)guid.Data4[2], (int)guid.Data4[3],
(int)guid.Data4[4], (int)guid.Data4[5], (int)guid.Data4[6], (int)guid.Data4[7]);
}
if (StringCchPrintfW(subject_str, ARRAYSIZE(subject_str), L"%s [%s]", subject, uid_str) == S_OK)
return subject_str;
else
return subject;
}
BOOL SendData(HWND hwnd)
{
BOOL retCode = FALSE;
const wchar_t *subject = L"Winamp Error Report";
const wchar_t *senderName = L"Winamp Error Reporter";
const wchar_t *recipientAddress = L"bug@winamp.com";
const wchar_t *recipientName = L"Nullsoft Bug Reporting";
wchar_t *msgInfo = _wcsdup(settings.ReadBody());
wchar_t *p = msgInfo, *end = p + wcslen(msgInfo);
while(p != end)
{
if (*p == 1) *p = L'\r';
if (*p == 2) *p = L'\n';
p++;
}
if (settings.sendBySMTP)
{
CSmtp smtp;
CSmtpMessage msg;
CSmtpMessageBody body;
CSmtpAttachment attach;
msg.Subject = BuildSubjectString(subject);
// Who the message is from
msg.Sender.Name = senderName;
msg.Sender.Address = settings.smtpAddress;
msg.Recipient.Address = recipientAddress;
msg.Recipient.Name = recipientName;
if(settings.zipData )
{
attach.FileName = settings.zipPath;
msg.Attachments.Add(attach);
}
else
{
if (settings.createLOG && settings.ReadLogCollectResult()) attach.FileName = settings.logPath;
msg.Attachments.Add(attach);
if (settings.createDMP && settings.ReadDmpCollectResult()) attach.FileName = settings.dumpPath;
msg.Attachments.Add(attach);
}
// smtp.m_wSmtpPort = settings.smtpPort; - not working for some reasons
if (settings.smtpAuth)
{
smtp.m_strUser = settings.smtpUser;
smtp.m_strPass = settings.smtpPwd;;
}
body = L"This message was generated by Winamp Error Reporter v1.09.\r\nPlease check attachments for viruses.\r\n";
body.Data.append(L"\r\n");
body.Data.append(msgInfo);
msg.Message.Add(body);
retCode = smtp.Connect(settings.smtpServer);
if ( retCode )
{
// Send the message and close the connection afterwards
retCode = (smtp.SendMessage(msg) == 0);
smtp.Close();
}
}
else if(settings.sendByClient)
{
retCode = SendEmail(hwnd, recipientAddress, recipientName, BuildSubjectString(subject), msgInfo, settings.zipPath);
}
return retCode;
}
BOOL Restart(void)
{
STARTUPINFO si = {0};
si.cb = sizeof(si);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_SHOW;
PROCESS_INFORMATION pi = {0};
return CreateProcess(
settings.ReadWinamp(), // name of executable module
NULL, // command line string
NULL, // process attributes
NULL, // thread attributes
FALSE, // handle inheritance option
0, // creation flags
NULL, // new environment block
NULL, // current directory name
&si, // startup information
&pi // process information
);
}
@@ -0,0 +1,29 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by feedback.rc
//
#define IDC_MYICON 2
#define IDD_DLG_SILENT 102
#define IDS_APP_TITLE 103
#define IDM_ABOUT 104
#define IDM_EXIT 105
#define ICON_XP 108
#define IDR_MAINFRAME 128
#define IDR_RT_MANIFEST1 133
#define IDC_PRG_COLLECT 1000
#define IDC_LBL_STEP 1001
#define IDC_BUTTON1 1003
#define IDC_BUTTON2 1004
#define IDC_STATIC -1
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 134
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1005
#define _APS_NEXT_SYMED_VALUE 110
#endif
#endif
@@ -0,0 +1,134 @@
#include ".\main.h"
#include <commctrl.h>
#include <shlobj.h>
#include "resource.h"
BOOL CALLBACK SilentDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_INITDIALOG:
{
HICON hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(ICON_XP));
SetClassLongPtr(hwndDlg, GCLP_HICON, (LONG_PTR)hIcon);
HWND hwndPrg = GetDlgItem(hwndDlg, IDC_PRG_COLLECT);
SendMessage(hwndPrg, PBM_SETRANGE, 0, MAKELPARAM(0,100));
SendMessage(hwndPrg, PBM_SETPOS, 0, 0);
SetDlgItemText(hwndDlg, IDC_LBL_STEP, L"Starting reporter...");
ShowWindow(GetDlgItem(hwndDlg, IDC_BUTTON1), SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_BUTTON2), SW_HIDE);
UpdateWindow(hwndDlg);
if ((settings.createLOG && !settings.ReadLogCollectResult()) &&
(settings.createDMP && !settings.ReadDmpCollectResult()) )
{
SetDlgItemText(hwndDlg, IDC_LBL_STEP, L"Error. Data was not generated.");
SendMessage(hwndPrg, PBM_SETPOS, 100, 0);
UpdateWindow(hwndDlg);
SetTimer(hwndDlg, 126, 2000, NULL);
break;
}
SetTimer(hwndDlg, 123, 500, NULL);
break;
}
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_BUTTON1:
{
BOOL ret = FALSE;
wchar_t file[MAX_PATH] = {0};
lstrcpyn(file, settings.zipPath, MAX_PATH);
LPSHELLFOLDER pDesktopFolder = 0;
if(SUCCEEDED(SHGetDesktopFolder(&pDesktopFolder)))
{
LPITEMIDLIST filepidl = 0;
HRESULT hr = pDesktopFolder->ParseDisplayName(NULL,0,file,0,&filepidl,0);
if(FAILED(hr)){ pDesktopFolder->Release(); ret = FALSE; }
else
{
if(SUCCEEDED(SHOpenFolderAndSelectItems(filepidl,0,NULL,NULL))){
ret = TRUE;
}
}
}
if (ret == FALSE)
{
SetDlgItemText(hwndDlg, IDC_LBL_STEP, L"Error. Unable to locate crash report.");
UpdateWindow(hwndDlg);
}
}
break;
case IDCANCEL:
case IDC_BUTTON2:
SetTimer(hwndDlg, 126, 1, NULL);
break;
}
break;
case WM_TIMER:
if (wParam == 123)
{
KillTimer(hwndDlg, wParam);
HWND hwndPrg;
hwndPrg = GetDlgItem(hwndDlg, IDC_PRG_COLLECT);
SendMessage(hwndPrg, PBM_SETPOS, 20, 0);
if (settings.zipData)
{
SetDlgItemText(hwndDlg, IDC_LBL_STEP, L"Packing results...");
if(!ZipData())
{
SetDlgItemText(hwndDlg, IDC_LBL_STEP, L"Error. Unable to pack results.");
SendMessage(hwndPrg, PBM_SETPOS, 100, 0);
UpdateWindow(hwndDlg);
SetTimer(hwndDlg, 126, 2000, NULL);
break;
}
}
SendMessage(hwndPrg, PBM_SETPOS, 40, 0);
UpdateWindow(hwndDlg);
if (settings.sendData)
{
SetDlgItemText(hwndDlg, IDC_LBL_STEP, L"Sending results...");
UpdateWindow(hwndDlg);
if(!SendData(hwndDlg))
{
SetDlgItemText(hwndDlg, IDC_LBL_STEP, L"Error. Unable to send crash report.");
SendMessage(hwndPrg, PBM_SETPOS, 100, 0);
ShowWindow(GetDlgItem(hwndDlg, IDC_BUTTON1), SW_SHOW);
ShowWindow(GetDlgItem(hwndDlg, IDC_BUTTON2), SW_SHOW);
ShowWindow(GetDlgItem(hwndDlg, IDC_PRG_COLLECT), SW_HIDE);
UpdateWindow(hwndDlg);
break;
}
}
if (settings.autoRestart)
{
SetDlgItemText(hwndDlg, IDC_LBL_STEP, L"Restarting Winamp...");
SendMessage(hwndPrg, PBM_SETPOS, 80, 0);
UpdateWindow(hwndDlg);
if(!Restart())
{
SetDlgItemText(hwndDlg, IDC_LBL_STEP, L"Error. Unable to restart Winamp.");
SendMessage(hwndPrg, PBM_SETPOS, 100, 0);
UpdateWindow(hwndDlg);
SetTimer(hwndDlg, 126, 2000, NULL);
break;
}
}
SetDlgItemText(hwndDlg, IDC_LBL_STEP, L"Done.");
SendMessage(hwndPrg, PBM_SETPOS, 100, 0);
UpdateWindow(hwndDlg);
SetTimer(hwndDlg, 126, 1000, NULL);
}
else if (wParam == 126)
{
KillTimer(hwndDlg, wParam);
EndDialog(hwndDlg, TRUE);
}
break;
}
return FALSE;
}
@@ -0,0 +1,320 @@
// CBase64.cpp: implementation of the CBase64 class.
//
//////////////////////////////////////////////////////////////////////
#include "Base64.h"
// Digits...
static char Base64Digits[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
BOOL CBase64::m_Init = FALSE;
char CBase64::m_DecodeTable[256];
#ifndef PAGESIZE
#define PAGESIZE 4096
#endif
#ifndef ROUNDTOPAGE
#define ROUNDTOPAGE(a) (((a/4096)+1)*4096)
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CBase64::CBase64()
: m_pDBuffer(NULL),
m_pEBuffer(NULL),
m_nDBufLen(0),
m_nEBufLen(0),
m_nDDataLen(0),
m_nEDataLen(0)
{
}
CBase64::~CBase64()
{
if(m_pDBuffer != NULL)
delete [] m_pDBuffer;
if(m_pEBuffer != NULL)
delete [] m_pEBuffer;
}
LPCSTR CBase64::DecodedMessage() const
{
return (LPCSTR) m_pDBuffer;
}
LPCSTR CBase64::EncodedMessage() const
{
return (LPCSTR) m_pEBuffer;
}
void CBase64::AllocEncode(DWORD nSize)
{
if(m_nEBufLen < nSize)
{
if(m_pEBuffer != NULL)
delete [] m_pEBuffer;
m_nEBufLen = ROUNDTOPAGE(nSize);
m_pEBuffer = new BYTE[m_nEBufLen];
}
::ZeroMemory(m_pEBuffer, m_nEBufLen);
m_nEDataLen = 0;
}
void CBase64::AllocDecode(DWORD nSize)
{
if(m_nDBufLen < nSize)
{
if(m_pDBuffer != NULL)
delete [] m_pDBuffer;
m_nDBufLen = ROUNDTOPAGE(nSize);
m_pDBuffer = new BYTE[m_nDBufLen];
}
::ZeroMemory(m_pDBuffer, m_nDBufLen);
m_nDDataLen = 0;
}
void CBase64::SetEncodeBuffer(const PBYTE pBuffer, DWORD nBufLen)
{
DWORD i = 0;
AllocEncode(nBufLen);
while(i < nBufLen)
{
if(!_IsBadMimeChar(pBuffer[i]))
{
m_pEBuffer[m_nEDataLen] = pBuffer[i];
m_nEDataLen++;
}
i++;
}
}
void CBase64::SetDecodeBuffer(const PBYTE pBuffer, DWORD nBufLen)
{
AllocDecode(nBufLen);
::CopyMemory(m_pDBuffer, pBuffer, nBufLen);
m_nDDataLen = nBufLen;
}
void CBase64::Encode(const PBYTE pBuffer, DWORD nBufLen)
{
SetDecodeBuffer(pBuffer, nBufLen);
AllocEncode(nBufLen * 2);
TempBucket Raw;
DWORD nIndex = 0;
while((nIndex + 3) <= nBufLen)
{
Raw.Clear();
::CopyMemory(&Raw, m_pDBuffer + nIndex, 3);
Raw.nSize = 3;
_EncodeToBuffer(Raw, m_pEBuffer + m_nEDataLen);
nIndex += 3;
m_nEDataLen += 4;
}
if(nBufLen > nIndex)
{
Raw.Clear();
Raw.nSize = (BYTE) (nBufLen - nIndex);
::CopyMemory(&Raw, m_pDBuffer + nIndex, nBufLen - nIndex);
_EncodeToBuffer(Raw, m_pEBuffer + m_nEDataLen);
m_nEDataLen += 4;
}
}
void CBase64::Encode(LPCSTR szMessage)
{
if(szMessage != NULL)
CBase64::Encode((const PBYTE)szMessage, lstrlenA(szMessage));
}
void CBase64::Decode(const PBYTE pBuffer, DWORD dwBufLen)
{
if(!CBase64::m_Init)
_Init();
SetEncodeBuffer(pBuffer, dwBufLen);
AllocDecode(dwBufLen);
TempBucket Raw;
DWORD nIndex = 0;
while((nIndex + 4) <= m_nEDataLen)
{
Raw.Clear();
Raw.nData[0] = CBase64::m_DecodeTable[m_pEBuffer[nIndex]];
Raw.nData[1] = CBase64::m_DecodeTable[m_pEBuffer[nIndex + 1]];
Raw.nData[2] = CBase64::m_DecodeTable[m_pEBuffer[nIndex + 2]];
Raw.nData[3] = CBase64::m_DecodeTable[m_pEBuffer[nIndex + 3]];
if(Raw.nData[2] == 255)
Raw.nData[2] = 0;
if(Raw.nData[3] == 255)
Raw.nData[3] = 0;
Raw.nSize = 4;
_DecodeToBuffer(Raw, m_pDBuffer + m_nDDataLen);
nIndex += 4;
m_nDDataLen += 3;
}
// If nIndex < m_nEDataLen, then we got a decode message without padding.
// We may want to throw some kind of warning here, but we are still required
// to handle the decoding as if it was properly padded.
if(nIndex < m_nEDataLen)
{
Raw.Clear();
for(DWORD i = nIndex; i < m_nEDataLen; i++)
{
Raw.nData[i - nIndex] = CBase64::m_DecodeTable[m_pEBuffer[i]];
Raw.nSize++;
if(Raw.nData[i - nIndex] == 255)
Raw.nData[i - nIndex] = 0;
}
_DecodeToBuffer(Raw, m_pDBuffer + m_nDDataLen);
m_nDDataLen += (m_nEDataLen - nIndex);
}
}
void CBase64::Decode(LPCSTR szMessage)
{
if(szMessage != NULL)
CBase64::Decode((const PBYTE)szMessage, lstrlenA(szMessage));
}
DWORD CBase64::_DecodeToBuffer(const TempBucket &Decode, PBYTE pBuffer)
{
TempBucket Data;
DWORD nCount = 0;
_DecodeRaw(Data, Decode);
for(int i = 0; i < 3; i++)
{
pBuffer[i] = Data.nData[i];
if(pBuffer[i] != 255)
nCount++;
}
return nCount;
}
void CBase64::_EncodeToBuffer(const TempBucket &Decode, PBYTE pBuffer)
{
TempBucket Data;
_EncodeRaw(Data, Decode);
for(int i = 0; i < 4; i++)
pBuffer[i] = Base64Digits[Data.nData[i]];
switch(Decode.nSize)
{
case 1:
pBuffer[2] = '=';
case 2:
pBuffer[3] = '=';
}
}
void CBase64::_DecodeRaw(TempBucket &Data, const TempBucket &Decode)
{
BYTE nTemp;
Data.nData[0] = Decode.nData[0];
Data.nData[0] <<= 2;
nTemp = Decode.nData[1];
nTemp >>= 4;
nTemp &= 0x03;
Data.nData[0] |= nTemp;
Data.nData[1] = Decode.nData[1];
Data.nData[1] <<= 4;
nTemp = Decode.nData[2];
nTemp >>= 2;
nTemp &= 0x0F;
Data.nData[1] |= nTemp;
Data.nData[2] = Decode.nData[2];
Data.nData[2] <<= 6;
nTemp = Decode.nData[3];
nTemp &= 0x3F;
Data.nData[2] |= nTemp;
}
void CBase64::_EncodeRaw(TempBucket &Data, const TempBucket &Decode)
{
BYTE nTemp;
Data.nData[0] = Decode.nData[0];
Data.nData[0] >>= 2;
Data.nData[1] = Decode.nData[0];
Data.nData[1] <<= 4;
nTemp = Decode.nData[1];
nTemp >>= 4;
Data.nData[1] |= nTemp;
Data.nData[1] &= 0x3F;
Data.nData[2] = Decode.nData[1];
Data.nData[2] <<= 2;
nTemp = Decode.nData[2];
nTemp >>= 6;
Data.nData[2] |= nTemp;
Data.nData[2] &= 0x3F;
Data.nData[3] = Decode.nData[2];
Data.nData[3] &= 0x3F;
}
BOOL CBase64::_IsBadMimeChar(BYTE nData)
{
switch(nData)
{
case '\r': case '\n': case '\t': case ' ' :
case '\b': case '\a': case '\f': case '\v':
return TRUE;
default:
return FALSE;
}
}
void CBase64::_Init()
{ // Initialize Decoding table.
int i;
for(i = 0; i < 256; i++)
CBase64::m_DecodeTable[i] = -2;
for(i = 0; i < 64; i++)
{
CBase64::m_DecodeTable[Base64Digits[i]] = (CHAR)i;
CBase64::m_DecodeTable[Base64Digits[i]|0x80] = (CHAR)i;
}
CBase64::m_DecodeTable['='] = -1;
CBase64::m_DecodeTable['='|0x80] = -1;
CBase64::m_Init = TRUE;
}
@@ -0,0 +1,63 @@
// CBase64.h: interface for the CBase64 class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_CBase64_H__B2E45717_0625_11D2_A80A_00C04FB6794C__INCLUDED_)
#define AFX_CBase64_H__B2E45717_0625_11D2_A80A_00C04FB6794C__INCLUDED_
#include <windows.h>
#define lCONTEXT char
#define PlCONTEXT lCONTEXT*
class CBase64
{
// Internal bucket class.
class TempBucket
{
public:
BYTE nData[4];
BYTE nSize;
void Clear() { ::ZeroMemory(nData, 4); nSize = 0; };
};
PBYTE m_pDBuffer;
PBYTE m_pEBuffer;
DWORD m_nDBufLen;
DWORD m_nEBufLen;
DWORD m_nDDataLen;
DWORD m_nEDataLen;
public:
CBase64();
virtual ~CBase64();
public:
virtual void Encode(const PBYTE, DWORD);
virtual void Decode(const PBYTE, DWORD);
virtual void Encode(LPCSTR sMessage);
virtual void Decode(LPCSTR sMessage);
virtual LPCSTR DecodedMessage() const;
virtual LPCSTR EncodedMessage() const;
virtual void AllocEncode(DWORD);
virtual void AllocDecode(DWORD);
virtual void SetEncodeBuffer(const PBYTE pBuffer, DWORD nBufLen);
virtual void SetDecodeBuffer(const PBYTE pBuffer, DWORD nBufLen);
protected:
virtual void _EncodeToBuffer(const TempBucket &Decode, PBYTE pBuffer);
virtual ULONG _DecodeToBuffer(const TempBucket &Decode, PBYTE pBuffer);
virtual void _EncodeRaw(TempBucket &, const TempBucket &);
virtual void _DecodeRaw(TempBucket &, const TempBucket &);
virtual BOOL _IsBadMimeChar(BYTE);
static char m_DecodeTable[256];
static BOOL m_Init;
void _Init();
};
#endif // !defined(AFX_CBase64_H__B2E45717_0625_11D2_A80A_00C04FB6794C__INCLUDED_)
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,245 @@
// Smtp.h: interface for the CSmtp class.
//
// Written by Robert Simpson (robert@blackcastlesoft.com)
// Created 11/1/2000
// Version 1.7 -- Last Modified 06/18/2001
// See smtp.cpp for details of this revision
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_SMTP_H__F5ACA8FA_AF73_11D4_907D_0080C6F7C752__INCLUDED_)
#define AFX_SMTP_H__F5ACA8FA_AF73_11D4_907D_0080C6F7C752__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#pragma comment(lib,"wsock32.lib")
#include <atlbase.h>
#include <winsock.h>
#include <string>
#include "Base64.h"
// Some ATL string conversion enhancements
// ATL's string conversions allocate memory on the stack, which can
// be undesirable if converting huge strings. These enhancements
// provide for a pre-allocated memory block to be used as the
// destination for the string conversion.
#define _W2A(dst,src) AtlW2AHelper(dst,src,lstrlenW(src)+1)
#define _A2W(dst,src) AtlA2WHelper(dst,src,lstrlenA(src)+1)
typedef std::wstring StringW;
typedef std::string StringA;
#ifdef _UNICODE
typedef StringW String;
#define _W2T(dst,src) lstrcpyW(dst,src)
#define _T2W(dst,src) lstrcpyW(dst,src)
#define _T2A(dst,src) _W2A(dst,src)
#define _A2T(dst,src) _A2W(dst,src)
#else
typedef StringA String;
#define _W2T(dst,src) _W2A(dst,src)
#define _T2W(dst,src) _A2W(dst,src)
#define _T2A(dst,src) lstrcpyA(dst,src)
#define _A2T(dst,src) lstrcpyA(dst,src)
#endif
// When the SMTP server responds to a command, this is the
// maximum size of a response I expect back.
#ifndef CMD_RESPONSE_SIZE
#define CMD_RESPONSE_SIZE 1024
#endif
// The CSmtp::SendCmd() function will send blocks no larger than this value
// Any outgoing data larger than this value will trigger an SmtpProgress()
// event for all blocks sent.
#ifndef CMD_BLOCK_SIZE
#define CMD_BLOCK_SIZE 1024
#endif
// Default mime version is 1.0 of course
#ifndef MIME_VERSION
#define MIME_VERSION _T("1.0")
#endif
// This is the message that would appear in an e-mail client that doesn't support
// multipart messages
#ifndef MULTIPART_MESSAGE
#define MULTIPART_MESSAGE _T("This is a multipart message in MIME format")
#endif
// Default message body encoding
#ifndef MESSAGE_ENCODING
#define MESSAGE_ENCODING _T("text/plain")
#endif
// Default character set
#ifndef MESSAGE_CHARSET
#define MESSAGE_CHARSET _T("iso-8859-1")
#endif
// Some forward declares
class CSmtp;
class CSmtpAddress;
class CSmtpMessage;
class CSmtpAttachment;
class CSmtpMessageBody;
class CSmtpMimePart;
// These are the only 4 encoding methods currently supported
typedef enum EncodingEnum
{
encodeGuess,
encode7Bit,
encode8Bit,
encodeQuotedPrintable,
encodeBase64
};
// This code supports three types of mime-types, and can optionally guess a mime type
// based on message content.
typedef enum MimeTypeEnum
{
mimeGuess,
mimeMixed,
mimeAlternative,
mimeRelated
};
// Attachments and message bodies inherit from this class
// It allows each part of a multipart MIME message to have its own attributes
class CSmtpMimePart
{
public:
String Encoding; // Content encoding. Leave blank to let the system discover it
String Charset; // Character set for text attachments
String ContentId; // Unique content ID, leave blank to let the system handle it
EncodingEnum TransferEncoding; // How to encode for transferring to the server
};
// This class represents a user's text name and corresponding email address
class CSmtpAddress
{
public: // Constructors
CSmtpAddress(LPCTSTR pszAddress = NULL, LPCTSTR pszName = NULL);
public: // Operators
const CSmtpAddress& operator=(LPCTSTR pszAddress);
const CSmtpAddress& operator=(const String& strAddress);
public: // Member Variables
String Name;
String Address;
};
// This class represents a file attachment
class CSmtpAttachment : public CSmtpMimePart
{
public: // Constructors
CSmtpAttachment(LPCTSTR pszFilename = NULL, LPCTSTR pszAltName = NULL, BOOL bIsInline = FALSE, LPCTSTR pszEncoding = NULL, LPCTSTR pszCharset = MESSAGE_CHARSET, EncodingEnum encode = encodeGuess);
public: // Operators
const CSmtpAttachment& operator=(LPCTSTR pszFilename);
const CSmtpAttachment& operator=(const String& strFilename);
public: // Member Variables
String FileName; // Fully-qualified path and filename of this attachment
String AltName; // Optional, an alternate name for the file to use when sending
BOOL Inline; // Is this an inline attachment?
};
// Multiple message body part support
class CSmtpMessageBody : public CSmtpMimePart
{
public: // Constructors
CSmtpMessageBody(LPCTSTR pszBody = NULL, LPCTSTR pszEncoding = MESSAGE_ENCODING, LPCTSTR pszCharset = MESSAGE_CHARSET, EncodingEnum encode = encodeGuess);
public: // Operators
const CSmtpMessageBody& operator=(LPCTSTR pszBody);
const CSmtpMessageBody& operator=(const String& strBody);
public: // Member Variables
String Data; // Message body;
};
// This class represents a single message that can be sent via CSmtp
class CSmtpMessage
{
public: // Constructors
CSmtpMessage();
public: // Member Variables
CSmtpAddress Sender; // Who the message is from
CSmtpAddress Recipient; // The intended recipient
String Subject; // The message subject
CSimpleArray<CSmtpMessageBody> Message; // An array of message bodies
CSimpleArray<CSmtpAddress> CC; // Carbon Copy recipients
CSimpleArray<CSmtpAddress> BCC; // Blind Carbon Copy recipients
CSimpleArray<CSmtpAttachment> Attachments; // An array of attachments
CSimpleMap<String,String> Headers; // Optional headers to include in the message
SYSTEMTIME Timestamp; // Timestamp of the message
MimeTypeEnum MimeType; // Type of MIME message this is
String MessageId; // Optional message ID
private: // Private Member Variables
int GMTOffset; // GMT timezone offset value
public: // Public functions
void Parse(String& strDest);
private: // Private functions to finalize the message headers & parse the message
EncodingEnum GuessEncoding(LPBYTE pByte, DWORD dwLen);
void EncodeMessage(EncodingEnum code, String& strMsg, String& strMethod, LPBYTE pByte = NULL, DWORD dwSize = 0);
void Make7Bit(String& strDest, String& strSrc);
void CommitHeaders();
void BreakMessage(String& strDest, String& strSrc, int nLength = 76);
void EncodeQuotedPrintable(String& strDest, String& strSrc);
};
// The main class for connecting to a SMTP server and sending mail.
class CSmtp
{
public: // Constructors
CSmtp();
virtual ~CSmtp();
public: // Member Variables. Feel free to modify these to change the system's behavior
BOOL m_bExtensions; // Use ESMTP extensions (TRUE)
DWORD m_dwCmdTimeout; // Timeout for issuing each command (30 seconds)
WORD m_wSmtpPort; // Port to communicate via SMTP (25)
String m_strUser; // Username for authentication
String m_strPass; // Password for authentication
private: // Private Member Variables
SOCKET m_hSocket; // Socket being used to communicate to the SMTP server
String m_strResult; // String result from a SendCmd()
BOOL m_bConnected; // Connected to SMTP server
BOOL m_bUsingExtensions;// Whether this SMTP server uses ESMTP extensions
public: // These represent the primary public functionality of this class
BOOL Connect(LPTSTR pszServer);
int SendMessage(CSmtpMessage& msg);
int SendMessage(CSmtpAddress& addrFrom, CSmtpAddress& addrTo, LPCTSTR pszSubject, LPTSTR pszMessage, LPVOID pvAttachments = NULL, DWORD dwAttachmentCount = 0);
int SendMessage(LPTSTR pszAddrFrom, LPTSTR pszAddrTo, LPTSTR pszSubject, LPTSTR pszMessage, LPVOID pvAttachments = NULL, DWORD dwAttachmentCount = 0);
void Close();
public: // These represent the overridable methods for receiving events from this class
virtual int SmtpWarning(int nWarning, LPTSTR pszWarning);
virtual int SmtpError(int nCode, LPTSTR pszErr);
virtual void SmtpCommandResponse(LPTSTR pszCmd, int nResponse, LPTSTR pszResponse);
virtual BOOL SmtpProgress(LPSTR pszBuffer, DWORD dwSent, DWORD dwTotal);
private: // These functions are used privately to conduct a SMTP session
int SendCmd(LPTSTR pszCmd);
int SendAuthentication();
int SendHello();
int SendQuitCmd();
int SendFrom(LPTSTR pszFrom);
int SendTo(LPTSTR pszTo);
int SendData(CSmtpMessage &msg);
int RaiseWarning(int nWarning);
int RaiseError(int nError);
};
#endif // !defined(AFX_SMTP_H__F5ACA8FA_AF73_11D4_907D_0080C6F7C752__INCLUDED_)
@@ -0,0 +1,39 @@
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
#include "..\..\..\..\Winamp/buildType.h"
VS_VERSION_INFO VERSIONINFO
FILEVERSION WINAMP_PRODUCTVER
PRODUCTVERSION WINAMP_PRODUCTVER
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Winamp SA"
VALUE "FileDescription", "Winamp Error Reporter"
VALUE "FileVersion", STR_WINAMP_PRODUCTVER
VALUE "InternalName", "Winamp Error Reporter"
VALUE "LegalCopyright", "Copyright © 2005-2023 Winamp SA"
VALUE "LegalTrademarks", "Nullsoft and Winamp are trademarks of Winamp SA"
VALUE "OriginalFilename", "feedback.exe"
VALUE "ProductName", "Winamp"
VALUE "ProductVersion", STR_WINAMP_PRODUCTVER
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,324 @@
// XZip.h Version 1.1
//
// Authors: Mark Adler et al. (see below)
//
// Modified by: Lucian Wischik
// lu@wischik.com
//
// Version 1.0 - Turned C files into just a single CPP file
// - Made them compile cleanly as C++ files
// - Gave them simpler APIs
// - Added the ability to zip/unzip directly in memory without
// any intermediate files
//
// Modified by: Hans Dietrich
// hdietrich2@hotmail.com
//
// Version 1.1: - Added Unicode support to CreateZip() and ZipAdd()
// - Changed file names to avoid conflicts with Lucian's files
//
///////////////////////////////////////////////////////////////////////////////
//
// Lucian Wischik's comments:
// --------------------------
// THIS FILE is almost entirely based upon code by info-zip.
// It has been modified by Lucian Wischik.
// The original code may be found at http://www.info-zip.org
// The original copyright text follows.
//
///////////////////////////////////////////////////////////////////////////////
//
// Original authors' comments:
// ---------------------------
// This is version 2002-Feb-16 of the Info-ZIP copyright and license. The
// definitive version of this document should be available at
// ftp://ftp.info-zip.org/pub/infozip/license.html indefinitely.
//
// Copyright (c) 1990-2002 Info-ZIP. All rights reserved.
//
// For the purposes of this copyright and license, "Info-ZIP" is defined as
// the following set of individuals:
//
// Mark Adler, John Bush, Karl Davis, Harald Denker, Jean-Michel Dubois,
// Jean-loup Gailly, Hunter Goatley, Ian Gorman, Chris Herborth, Dirk Haase,
// Greg Hartwig, Robert Heath, Jonathan Hudson, Paul Kienitz,
// David Kirschbaum, Johnny Lee, Onno van der Linden, Igor Mandrichenko,
// Steve P. Miller, Sergio Monesi, Keith Owens, George Petrov, Greg Roelofs,
// Kai Uwe Rommel, Steve Salisbury, Dave Smith, Christian Spieler,
// Antoine Verheijen, Paul von Behren, Rich Wales, Mike White
//
// This software is provided "as is", without warranty of any kind, express
// or implied. In no event shall Info-ZIP or its contributors be held liable
// for any direct, indirect, incidental, special or consequential damages
// arising out of the use of or inability to use this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. Redistributions of source code must retain the above copyright notice,
// definition, disclaimer, and this list of conditions.
//
// 2. Redistributions in binary form (compiled executables) must reproduce
// the above copyright notice, definition, disclaimer, and this list of
// conditions in documentation and/or other materials provided with the
// distribution. The sole exception to this condition is redistribution
// of a standard UnZipSFX binary as part of a self-extracting archive;
// that is permitted without inclusion of this license, as long as the
// normal UnZipSFX banner has not been removed from the binary or disabled.
//
// 3. Altered versions--including, but not limited to, ports to new
// operating systems, existing ports with new graphical interfaces, and
// dynamic, shared, or static library versions--must be plainly marked
// as such and must not be misrepresented as being the original source.
// Such altered versions also must not be misrepresented as being
// Info-ZIP releases--including, but not limited to, labeling of the
// altered versions with the names "Info-ZIP" (or any variation thereof,
// including, but not limited to, different capitalizations),
// "Pocket UnZip", "WiZ" or "MacZip" without the explicit permission of
// Info-ZIP. Such altered versions are further prohibited from
// misrepresentative use of the Zip-Bugs or Info-ZIP e-mail addresses or
// of the Info-ZIP URL(s).
//
// 4. Info-ZIP retains the right to use the names "Info-ZIP", "Zip", "UnZip",
// "UnZipSFX", "WiZ", "Pocket UnZip", "Pocket Zip", and "MacZip" for its
// own source and binary releases.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef XZIP_H
#define XZIP_H
// ZIP functions -- for creating zip files
// This file is a repackaged form of the Info-Zip source code available
// at www.info-zip.org. The original copyright notice may be found in
// zip.cpp. The repackaging was done by Lucian Wischik to simplify its
// use in Windows/C++.
#ifndef XUNZIP_H
DECLARE_HANDLE(HZIP); // An HZIP identifies a zip file that is being created
#endif
typedef DWORD ZRESULT; // result codes from any of the zip functions. Listed later.
// flag values passed to some functions
#define ZIP_HANDLE 1
#define ZIP_FILENAME 2
#define ZIP_MEMORY 3
#define ZIP_FOLDER 4
///////////////////////////////////////////////////////////////////////////////
//
// CreateZip()
//
// Purpose: Create a zip archive file
//
// Parameters: z - archive file name if flags is ZIP_FILENAME; for other
// uses see below
// len - for memory (ZIP_MEMORY) should be the buffer size;
// for other uses, should be 0
// flags - indicates usage, see below; for files, this will be
// ZIP_FILENAME
//
// Returns: HZIP - non-zero if zip archive created ok, otherwise 0
//
HZIP CreateZip(void *z, unsigned int len, DWORD flags);
// CreateZip - call this to start the creation of a zip file.
// As the zip is being created, it will be stored somewhere:
// to a pipe: CreateZip(hpipe_write, 0,ZIP_HANDLE);
// in a file (by handle): CreateZip(hfile, 0,ZIP_HANDLE);
// in a file (by name): CreateZip("c:\\test.zip", 0,ZIP_FILENAME);
// in memory: CreateZip(buf, len,ZIP_MEMORY);
// or in pagefile memory: CreateZip(0, len,ZIP_MEMORY);
// The final case stores it in memory backed by the system paging file,
// where the zip may not exceed len bytes. This is a bit friendlier than
// allocating memory with new[]: it won't lead to fragmentation, and the
// memory won't be touched unless needed.
// Note: because pipes don't allow random access, the structure of a zipfile
// created into a pipe is slightly different from that created into a file
// or memory. In particular, the compressed-size of the item cannot be
// stored in the zipfile until after the item itself. (Also, for an item added
// itself via a pipe, the uncompressed-size might not either be known until
// after.) This is not normally a problem. But if you try to unzip via a pipe
// as well, then the unzipper will not know these things about the item until
// after it has been unzipped. Therefore: for unzippers which don't just write
// each item to disk or to a pipe, but instead pre-allocate memory space into
// which to unzip them, then either you have to create the zip not to a pipe,
// or you have to add items not from a pipe, or at least when adding items
// from a pipe you have to specify the length.
///////////////////////////////////////////////////////////////////////////////
//
// ZipAdd()
//
// Purpose: Add a file to a zip archive
//
// Parameters: hz - handle to an open zip archive
// dstzn - name used inside the zip archive to identify the file
// src - for a file (ZIP_FILENAME) this specifies the filename
// to be added to the archive; for other uses, see below
// len - for memory (ZIP_MEMORY) this specifies the buffer
// length; for other uses, this should be 0
// flags - indicates usage, see below; for files, this will be
// ZIP_FILENAME
//
// Returns: ZRESULT - ZR_OK if success, otherwise some other value
//
ZRESULT ZipAdd(HZIP hz, const TCHAR *dstzn, void *src, unsigned int len, DWORD flags);
// ZipAdd - call this for each file to be added to the zip.
// dstzn is the name that the file will be stored as in the zip file.
// The file to be added to the zip can come
// from a pipe: ZipAdd(hz,"file.dat", hpipe_read,0,ZIP_HANDLE);
// from a file: ZipAdd(hz,"file.dat", hfile,0,ZIP_HANDLE);
// from a fname: ZipAdd(hz,"file.dat", "c:\\docs\\origfile.dat",0,ZIP_FILENAME);
// from memory: ZipAdd(hz,"subdir\\file.dat", buf,len,ZIP_MEMORY);
// (folder): ZipAdd(hz,"subdir", 0,0,ZIP_FOLDER);
// Note: if adding an item from a pipe, and if also creating the zip file itself
// to a pipe, then you might wish to pass a non-zero length to the ZipAdd
// function. This will let the zipfile store the items size ahead of the
// compressed item itself, which in turn makes it easier when unzipping the
// zipfile into a pipe.
///////////////////////////////////////////////////////////////////////////////
//
// CloseZip()
//
// Purpose: Close an open zip archive
//
// Parameters: hz - handle to an open zip archive
//
// Returns: ZRESULT - ZR_OK if success, otherwise some other value
//
ZRESULT CloseZip(HZIP hz);
// CloseZip - the zip handle must be closed with this function.
ZRESULT ZipGetMemory(HZIP hz, void **buf, unsigned long *len);
// ZipGetMemory - If the zip was created in memory, via ZipCreate(0,ZIP_MEMORY),
// then this function will return information about that memory block.
// buf will receive a pointer to its start, and len its length.
// Note: you can't add any more after calling this.
unsigned int FormatZipMessage(ZRESULT code, char *buf,unsigned int len);
// FormatZipMessage - given an error code, formats it as a string.
// It returns the length of the error message. If buf/len points
// to a real buffer, then it also writes as much as possible into there.
// These are the result codes:
#define ZR_OK 0x00000000 // nb. the pseudo-code zr-recent is never returned,
#define ZR_RECENT 0x00000001 // but can be passed to FormatZipMessage.
// The following come from general system stuff (e.g. files not openable)
#define ZR_GENMASK 0x0000FF00
#define ZR_NODUPH 0x00000100 // couldn't duplicate the handle
#define ZR_NOFILE 0x00000200 // couldn't create/open the file
#define ZR_NOALLOC 0x00000300 // failed to allocate some resource
#define ZR_WRITE 0x00000400 // a general error writing to the file
#define ZR_NOTFOUND 0x00000500 // couldn't find that file in the zip
#define ZR_MORE 0x00000600 // there's still more data to be unzipped
#define ZR_CORRUPT 0x00000700 // the zipfile is corrupt or not a zipfile
#define ZR_READ 0x00000800 // a general error reading the file
// The following come from mistakes on the part of the caller
#define ZR_CALLERMASK 0x00FF0000
#define ZR_ARGS 0x00010000 // general mistake with the arguments
#define ZR_NOTMMAP 0x00020000 // tried to ZipGetMemory, but that only works on mmap zipfiles, which yours wasn't
#define ZR_MEMSIZE 0x00030000 // the memory size is too small
#define ZR_FAILED 0x00040000 // the thing was already failed when you called this function
#define ZR_ENDED 0x00050000 // the zip creation has already been closed
#define ZR_MISSIZE 0x00060000 // the indicated input file size turned out mistaken
#define ZR_PARTIALUNZ 0x00070000 // the file had already been partially unzipped
#define ZR_ZMODE 0x00080000 // tried to mix creating/opening a zip
// The following come from bugs within the zip library itself
#define ZR_BUGMASK 0xFF000000
#define ZR_NOTINITED 0x01000000 // initialisation didn't work
#define ZR_SEEK 0x02000000 // trying to seek in an unseekable file
#define ZR_NOCHANGE 0x04000000 // changed its mind on storage, but not allowed
#define ZR_FLATE 0x05000000 // an internal error in the de/inflation code
// e.g.
//
// (1) Traditional use, creating a zipfile from existing files
// HZIP hz = CreateZip("c:\\temp.zip",0,ZIP_FILENAME);
// ZipAdd(hz,"src1.txt", "c:\\src1.txt",0,ZIP_FILENAME);
// ZipAdd(hz,"src2.bmp", "c:\\src2_origfn.bmp",0,ZIP_FILENAME);
// CloseZip(hz);
//
// (2) Memory use, creating an auto-allocated mem-based zip file from various sources
// HZIP hz = CreateZip(0,100000,ZIP_MEMORY);
// // adding a conventional file...
// ZipAdd(hz,"src1.txt", "c:\\src1.txt",0,ZIP_FILENAME);
// // adding something from memory...
// char buf[1000]; for (int i=0; i<1000; i++) buf[i]=(char)(i&0x7F);
// ZipAdd(hz,"file.dat", buf,1000,ZIP_MEMORY);
// // adding something from a pipe...
// HANDLE hread,hwrite; CreatePipe(&hread,&write,NULL,0);
// HANDLE hthread = CreateThread(ThreadFunc,(void*)hwrite);
// ZipAdd(hz,"unz3.dat", hread,0,ZIP_HANDLE);
// WaitForSingleObject(hthread,INFINITE);
// CloseHandle(hthread); CloseHandle(hread);
// ... meanwhile DWORD CALLBACK ThreadFunc(void *dat)
// { HANDLE hwrite = (HANDLE)dat;
// char buf[1000]={17};
// DWORD writ; WriteFile(hwrite,buf,1000,&writ,NULL);
// CloseHandle(hwrite);
// return 0;
// }
// // and now that the zip is created, let's do something with it:
// void *zbuf; unsigned long zlen; ZipGetMemory(hz,&zbuf,&zlen);
// HANDLE hfz = CreateFile("test2.zip",GENERIC_WRITE,CREATE_ALWAYS);
// DWORD writ; WriteFile(hfz,zbuf,zlen,&writ,NULL);
// CloseHandle(hfz);
// CloseZip(hz);
//
// (3) Handle use, for file handles and pipes
// HANDLE hzread,hzwrite; CreatePipe(&hzread,&hzwrite);
// HANDLE hthread = CreateThread(ZipReceiverThread,(void*)hread);
// HZIP hz = ZipCreate(hzwrite,ZIP_HANDLE);
// // ... add to it
// CloseZip(hz);
// CloseHandle(hzwrite);
// WaitForSingleObject(hthread,INFINITE);
// CloseHandle(hthread);
// ... meanwhile DWORD CALLBACK ThreadFunc(void *dat)
// { HANDLE hread = (HANDLE)dat;
// char buf[1000] = {0};
// while (true)
// { DWORD red = 0; ReadFile(hread,buf,1000,&red,NULL);
// // ... and do something with this zip data we're receiving
// if (red==0) break;
// }
// CloseHandle(hread);
// return 0;
// }
//
// Now we indulge in a little skullduggery so that the code works whether
// the user has included just zip or both zip and unzip.
// Idea: if header files for both zip and unzip are present, then presumably
// the cpp files for zip and unzip are both present, so we will call
// one or the other of them based on a dynamic choice. If the header file
// for only one is present, then we will bind to that particular one.
HZIP CreateZipZ(void *z,unsigned int len,DWORD flags);
ZRESULT CloseZipZ(HZIP hz);
unsigned int FormatZipMessageZ(ZRESULT code, char *buf,unsigned int len);
bool IsZipHandleZ(HZIP hz);
#define CreateZip CreateZipZ
#ifdef XUNZIP_H
#undef CloseZip
#define CloseZip(hz) (IsZipHandleZ(hz)?CloseZipZ(hz):CloseZipU(hz))
#else
#define CloseZip CloseZipZ
#define FormatZipMessage FormatZipMessageZ
#endif
#endif //XZIP_H
@@ -0,0 +1,193 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"#include ""version.rc2""\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_CRASHDLG DIALOGEX 0, 0, 187, 42
STYLE DS_SYSMODAL | DS_SETFONT | DS_SETFOREGROUND | DS_FIXEDSYS | DS_NOFAILCREATE | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_NOPARENTNOTIFY
CAPTION "Winamp Error Reporter"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
ICON 102,IDC_BMP_LOGO,8,6,21,20,SS_REALSIZEIMAGE
LTEXT "",IDC_LBL_STEP,48,6,127,10
CONTROL "",IDC_PRG_COLLECT,"msctls_progress32",WS_BORDER,48,19,127,9
END
IDD_CONFIG DIALOGEX 0, 0, 273, 246
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
GROUPBOX "General",IDC_GRP_GENERAL,0,0,273,64
CONTROL "Auto Restart",IDC_CHK_RESTART,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,12,90,10
CONTROL "Compress results",IDC_CHK_COMPRESS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,24,90,10
CONTROL "Create Dump File",IDC_CHK_CREATEDMP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,36,90,10
CONTROL "Create Log File",IDC_CHK_CREATELOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,49,90,10
GROUPBOX "",IDC_GRP_EMAIL,101,13,165,45
CONTROL "Send Data",IDC_CHK_SEND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,106,12,46,10
CONTROL "Using default email program",IDC_RB_USECLIENT,"Button",BS_AUTORADIOBUTTON,106,27,105,10
CONTROL "Using SMTP server",IDC_RB_USESMTP,"Button",BS_AUTORADIOBUTTON,106,41,75,10
PUSHBUTTON "SMTP Settings...",IDC_BTN_SMTP,185,39,75,13
GROUPBOX "Dump File",IDC_GRP_DUMP,0,67,273,66
LTEXT "OS version:",IDC_LBL_OSVERSION_CAPTION,6,78,38,8
LTEXT "",IDC_LBL_OSVERSION,48,78,218,8
LTEXT "Dll path:",IDC_LBL_DLLPATH_CAPTION,6,90,38,8
LTEXT "",IDC_LBL_DLLPATH,48,90,218,8,SS_PATHELLIPSIS
LTEXT "Dll version:",IDC_LBL_DLLVERSION_CAPTION,6,102,38,8
LTEXT "unknown [unable to load]",IDC_LBL_DLLVERSION,48,102,219,8
LTEXT "Type:",IDC_LBL_DMPTYPE,6,116,20,8
COMBOBOX IDC_CMB_DMPTYPE,30,114,237,84,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Log File",IDC_GRP_LOG,0,136,273,28
CONTROL "System info",IDC_CHK_LOGSYSTEM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,149,53,10
CONTROL "Stack data",IDC_CHK_LOGSTACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,63,149,50,10
CONTROL "Registry state",IDC_CHK_LOGREGISTRY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,117,149,62,10
CONTROL "Loaded modules",IDC_CHK_LOGMODULE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,183,149,67,10
LTEXT "Save report in:",IDC_LBL_PATH,6,180,50,8
EDITTEXT IDC_EDT_PATH,60,178,188,12,ES_AUTOHSCROLL
PUSHBUTTON "...",IDC_BTN_PATH,249,178,19,12
GROUPBOX "File Paths",IDC_GRP_ZIP,1,168,272,76
LTEXT "Zip filename:",IDC_LBL_ZIPNAME,6,196,50,8
EDITTEXT IDC_EDT_ZIPNAME,60,194,208,12,ES_AUTOHSCROLL
LTEXT "Dump filename:",IDC_LBL_DMPNAME,6,212,50,8
EDITTEXT IDC_EDT_DMPNAME,60,210,208,12,ES_AUTOHSCROLL
LTEXT "Log filename:",IDC_LBL_LOGNAME,6,229,50,8
EDITTEXT IDC_EDT_LOGNAME,60,227,208,12,ES_AUTOHSCROLL
CONTROL "Do not ask questions",IDC_CHK_SILENT,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,281,0,90,10
END
IDD_DLG_SMTP DIALOGEX 0, 0, 180, 155
STYLE DS_SETFONT | DS_SETFOREGROUND | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_TOOLWINDOW
CAPTION "SMTP Settings"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
GROUPBOX "Server Details",IDC_GRP_AUTH2,5,5,170,63,BS_LEFT
LTEXT "Server:",IDC_LBL_SERVER,12,18,54,8
EDITTEXT IDC_EDT_SERVER,70,16,100,12,ES_AUTOHSCROLL
LTEXT "Port:",IDC_LBL_PORT,12,33,54,8
EDITTEXT IDC_EDT_PORT,70,32,21,12,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
LTEXT "Sender Address:",IDC_LBL_ADDRESS,12,50,54,8
EDITTEXT IDC_EDT_ADDRESS,70,48,100,14,ES_AUTOHSCROLL
GROUPBOX "Authentication",IDC_GRP_AUTH,5,71,170,62,BS_LEFT
CONTROL "Server requires authentication",IDC_CHK_AUTH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,84,116,9
LTEXT "User:",IDC_LBL_USER,11,100,34,8
EDITTEXT IDC_EDT_USER,49,97,120,12,ES_AUTOHSCROLL
LTEXT "Password:",IDC_LBL_PWD,11,116,34,8
EDITTEXT IDC_EDT_PWD,49,113,120,12,ES_PASSWORD | ES_AUTOHSCROLL
DEFPUSHBUTTON "Close",IDCANCEL,125,137,50,13
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_CRASHDLG, DIALOG
BEGIN
BOTTOMMARGIN, 39
END
IDD_DLG_SMTP, DIALOG
BEGIN
LEFTMARGIN, 5
RIGHTMARGIN, 175
TOPMARGIN, 5
BOTTOMMARGIN, 150
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_ERROR_FEEDBACK "Error Feedback"
IDS_UNKNOWN "unknown"
IDS_LOADED_OK "loaded"
IDS_UNABLE_TO_LOAD "unable to load"
IDS_NOT_FOUND "not found"
IDS_UNABLE_TO_SAVE_SETTINGS "Unable to save error feedback settings"
IDS_SAVE_ERROR "Save Error"
IDS_SELECT_FOLDER_FOR_ERROR_INFO
"Select folder where the error information will be saved to"
END
STRINGTABLE
BEGIN
IDS_NULLSOFT_ERROR_FEEDBACK "Nullsoft Error Feedback v%s"
65535 "{092A97EF-7DC0-41a7-80D1-90DEEB18F12D}"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#include "version.rc2"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
@@ -0,0 +1,31 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29424.173
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gen_crasher", "gen_crasher.vcxproj", "{A029F791-2838-4D16-BC92-C8E04D677948}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A029F791-2838-4D16-BC92-C8E04D677948}.Debug|Win32.ActiveCfg = Debug|Win32
{A029F791-2838-4D16-BC92-C8E04D677948}.Debug|Win32.Build.0 = Debug|Win32
{A029F791-2838-4D16-BC92-C8E04D677948}.Debug|x64.ActiveCfg = Debug|x64
{A029F791-2838-4D16-BC92-C8E04D677948}.Debug|x64.Build.0 = Debug|x64
{A029F791-2838-4D16-BC92-C8E04D677948}.Release|Win32.ActiveCfg = Release|Win32
{A029F791-2838-4D16-BC92-C8E04D677948}.Release|Win32.Build.0 = Release|Win32
{A029F791-2838-4D16-BC92-C8E04D677948}.Release|x64.ActiveCfg = Release|x64
{A029F791-2838-4D16-BC92-C8E04D677948}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A8CBA02D-A7C5-4784-BC88-C554B8121167}
EndGlobalSection
EndGlobal
@@ -0,0 +1,290 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{A029F791-2838-4D16-BC92-C8E04D677948}</ProjectGuid>
<RootNamespace>gen_crasher</RootNamespace>
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
<EmbedManifest>true</EmbedManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Label="Vcpkg">
<VcpkgEnabled>false</VcpkgEnabled>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<VcpkgConfiguration>Debug</VcpkgConfiguration>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WIN32_WINNT=0x0601;WINVER=0x0601;WIN32;_DEBUG;_WINDOWS;_USRDLL;GEN_CRASHER_EXPORTS;_WIN32_IE=0x0A00;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<BufferSecurityCheck>false</BufferSecurityCheck>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<Link>
<AdditionalDependencies>shlwapi.lib;Version.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\
xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ </Command>
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\'</Message>
</PostBuildEvent>
<ResourceCompile>
<PreprocessorDefinitions>_WIN32_WINNT=0x0601;WINVER=0x0601;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WIN32_WINNT=0x0601;WINVER=0x0601;_DEBUG;WIN64;_WINDOWS;_USRDLL;GEN_CRASHER_EXPORTS;_WIN32_IE=0x0A00;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<BrowseInformation>true</BrowseInformation>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<BufferSecurityCheck>false</BufferSecurityCheck>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<Link>
<AdditionalDependencies>shlwapi.lib;Version.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
</Link>
<PostBuildEvent>
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\
xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ </Command>
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\'</Message>
</PostBuildEvent>
<ResourceCompile>
<PreprocessorDefinitions>_WIN32_WINNT=0x0601;WINVER=0x0601;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MinSpace</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>..\..\..\Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WIN32_WINNT=0x0601;WINVER=0x0601;WIN32;NDEBUG;_WINDOWS;_USRDLL;GEN_CRASHER_EXPORTS;_WIN32_IE=0x0A00;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<ObjectFileName>$(IntDir)</ObjectFileName>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>None</DebugInformationFormat>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<Link>
<AdditionalDependencies>shlwapi.lib;Version.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<TurnOffAssemblyGeneration>true</TurnOffAssemblyGeneration>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ </Command>
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\'</Message>
</PostBuildEvent>
<ResourceCompile>
<PreprocessorDefinitions>_WIN32_WINNT=0x0601;WINVER=0x0601;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<Optimization>MinSpace</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>..\..\..\Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WIN32_WINNT=0x0601;WINVER=0x0601;NDEBUG;WIN64;_WINDOWS;_USRDLL;GEN_CRASHER_EXPORTS;_WIN32_IE=0x0A00;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<ObjectFileName>$(IntDir)</ObjectFileName>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>None</DebugInformationFormat>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<Link>
<AdditionalDependencies>shlwapi.lib;Version.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<TurnOffAssemblyGeneration>true</TurnOffAssemblyGeneration>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
</Link>
<PostBuildEvent>
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ </Command>
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\'</Message>
</PostBuildEvent>
<ResourceCompile>
<PreprocessorDefinitions>_WIN32_WINNT=0x0601;WINVER=0x0601;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Wasabi\Wasabi.vcxproj">
<Project>{3e0bfa8a-b86a-42e9-a33f-ec294f823f7f}</Project>
</ProjectReference>
<ProjectReference Include="feedback\feedback.vcxproj">
<Project>{a845d04c-a95e-424c-bfa8-d7706dba78bf}</Project>
<CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\nu\ServiceWatcher.cpp" />
<ClCompile Include="config.cpp" />
<ClCompile Include="configDlg.cpp" />
<ClCompile Include="crashDlg.cpp" />
<ClCompile Include="ExceptionHandler.cpp" />
<ClCompile Include="GetWinVer.cpp" />
<ClCompile Include="main.cpp" />
<ClCompile Include="MiniVersion.cpp" />
<ClCompile Include="settings.cpp" />
<ClCompile Include="smtpDlg.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\Winamp\wa_ipc.h" />
<ClInclude Include="api__gen_crasher.h" />
<ClInclude Include="config.h" />
<ClInclude Include="configDlg.h" />
<ClInclude Include="crashDlg.h" />
<ClInclude Include="ExceptionHandler.h" />
<ClInclude Include="GetWinVer.h" />
<ClInclude Include="main.h" />
<ClInclude Include="minidump.h" />
<ClInclude Include="MiniVersion.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="settings.h" />
<ClInclude Include="smtpDlg.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="gen_crasher.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="config.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="configDlg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="crashDlg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ExceptionHandler.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GetWinVer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="MiniVersion.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="settings.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="smtpDlg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\nu\ServiceWatcher.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="api__gen_crasher.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="config.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="configDlg.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="crashDlg.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ExceptionHandler.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GetWinVer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="main.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="minidump.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="MiniVersion.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="settings.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="smtpDlg.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\Winamp\wa_ipc.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="Header Files">
<UniqueIdentifier>{387133cc-523c-4c1f-8215-3de0d29784a3}</UniqueIdentifier>
</Filter>
<Filter Include="Ressource Files">
<UniqueIdentifier>{1515be17-59cd-45ca-abc3-a3b3e66c36b9}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files">
<UniqueIdentifier>{89f5adbb-9d33-4588-b2cb-942e0cc75987}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="gen_crasher.rc">
<Filter>Ressource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>
+140
View File
@@ -0,0 +1,140 @@
// Winamp error feedback plugin
// Copyright (C) 2005 Nullsoft
//#define PLUGIN_DESC "Nullsoft Error Feedback"
#define PLUGIN_VER L"1.16"
#include ".\main.h"
#include "configDlg.h"
#include "crashDlg.h"
#include "api__gen_crasher.h"
#include "../nu/ServiceWatcher.h"
ServiceWatcher watcher;
Settings settings;
prefsDlgRecW prefItem = {0};
char *winampVersion;
static wchar_t prefsTitle[64];
// wasabi based services for localisation support
api_service *WASABI_API_SVC = 0;
api_language *WASABI_API_LNG = 0;
api_syscb *WASABI_API_SYSCB = 0;
api_application *WASABI_API_APP = 0;
HINSTANCE WASABI_API_LNG_HINST = 0, WASABI_API_ORIG_HINST = 0;
int init(void);
void config(void);
void quit(void);
extern "C" winampGeneralPurposePlugin plugin =
{
GPPHDR_VER_U,
"nullsoft(gen_crasher.dll)",
init,
config,
quit,
};
extern "C" __declspec(dllexport) winampGeneralPurposePlugin * winampGetGeneralPurposePlugin() { return &plugin; }
int init(void)
{
if (!settings.IsOk()) return GEN_INIT_FAILURE;
// loader so that we can get the localisation service api for use
WASABI_API_SVC = (api_service*)SendMessage(plugin.hwndParent, WM_WA_IPC, 0, IPC_GET_API_SERVICE);
if (!WASABI_API_SVC || WASABI_API_SVC == (api_service *)1)
return GEN_INIT_FAILURE;
waServiceFactory *sf = WASABI_API_SVC->service_getServiceByGuid(applicationApiServiceGuid);
if (sf) WASABI_API_SYSCB = reinterpret_cast<api_syscb*>(sf->getInterface());
watcher.WatchWith(WASABI_API_SVC);
watcher.WatchFor(&WASABI_API_LNG, languageApiGUID);
WASABI_API_SYSCB->syscb_registerCallback(&watcher);
sf = WASABI_API_SVC->service_getServiceByGuid(applicationApiServiceGuid);
if (sf) WASABI_API_APP = reinterpret_cast<api_application*>(sf->getInterface());
// need to have this initialised before we try to do anything with localisation features
WASABI_API_START_LANG(plugin.hDllInstance,GenCrasherLangGUID);
static wchar_t szDescription[256];
swprintf(szDescription, ARRAYSIZE(szDescription),
WASABI_API_LNGSTRINGW(IDS_NULLSOFT_ERROR_FEEDBACK), PLUGIN_VER);
plugin.description = (char*)szDescription;
//register prefs screen
prefItem.dlgID = IDD_CONFIG;
prefItem.name = WASABI_API_LNGSTRINGW_BUF(IDS_ERROR_FEEDBACK,prefsTitle,64);
prefItem.proc = (void*) ConfigDlgProc;
prefItem.hInst = WASABI_API_LNG_HINST;
prefItem.where = -1;
SendMessageA(plugin.hwndParent, WM_WA_IPC, (WPARAM) &prefItem, IPC_ADD_PREFS_DLGW);
winampVersion = (char *)SendMessageA(plugin.hwndParent,WM_WA_IPC,0,IPC_GETVERSIONSTRING);
return GEN_INIT_SUCCESS;
}
void config(void)
{
SendMessage(plugin.hwndParent,WM_WA_IPC,(WPARAM)&prefItem,IPC_OPENPREFSTOPAGE);
}
void quit(void)
{
watcher.StopWatching();
watcher.Clear();
waServiceFactory *sf = WASABI_API_SVC->service_getServiceByGuid(languageApiGUID);
if (sf) sf->releaseInterface(WASABI_API_LNG);
WASABI_API_LNG=0;
}
int StartHandler(wchar_t* iniPath)
{
settings.SetPath(iniPath);
if (!settings.Load())
{
if (!(settings.CreateDefault(iniPath) && settings.Save()))
{
//OutputDebugString(L"Feedback plugin - unable to read settings. Error feedback disabled.\r\n");
}
}
SetUnhandledExceptionFilter(FeedBackFilter);
//OutputDebugString(L"Error FeedBack started.\r\n");
return 0;
}
PEXCEPTION_POINTERS gExceptionInfo;
LONG WINAPI FeedBackFilter( struct _EXCEPTION_POINTERS *pExceptionInfo )
{
if (alreadyProccessing) return EXCEPTION_CONTINUE_EXECUTION;
alreadyProccessing = TRUE;
gExceptionInfo = pExceptionInfo;
// show user dialog
HWND hwnd;
if (WASABI_API_LNG)
hwnd = WASABI_API_CREATEDIALOGPARAMW(IDD_CRASHDLG, NULL, CrashDlgProc, (LPARAM)WASABI_API_ORIG_HINST);
else
#ifdef _M_IX86
hwnd = CreateDialogParam(plugin.hDllInstance, MAKEINTRESOURCE(IDD_CRASHDLG), NULL, CrashDlgProc, (LPARAM)plugin.hDllInstance);
#endif
#ifdef _M_X64
hwnd = CreateDialogParam(plugin.hDllInstance, MAKEINTRESOURCE(IDD_CRASHDLG), NULL, (DLGPROC)CrashDlgProc, (LPARAM)plugin.hDllInstance);
#endif
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE);
while (IsWindow(hwnd))
{
MSG msg;
if (!GetMessage(&msg, NULL, 0, 0)) break;
if (IsDialogMessage(hwnd, &msg)) continue;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return EXCEPTION_EXECUTE_HANDLER;
}
+24
View File
@@ -0,0 +1,24 @@
#ifndef NULLSOFT_CRASHER_MAIN_H
#define NULLSOFT_CRASHER_MAIN_H
#include <windows.h>
#include <dbghelp.h>
#include "resource.h"
#define NO_IVIDEO_DECLARE
#include "..\winamp\wa_ipc.h"
#include "settings.h"
#include "../winamp/gen.h"
extern Settings settings;
extern prefsDlgRecW prefItem;
extern char *winampVersion;
extern "C" winampGeneralPurposePlugin plugin;
extern "C" __declspec(dllexport) int StartHandler(wchar_t* iniPath);
extern "C" LONG WINAPI FeedBackFilter( struct _EXCEPTION_POINTERS *pExceptionInfo );
//typedef struct _EXCEPTION_POINTERS EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
static BOOL alreadyProccessing;
#endif // NULLSOFT_CRASHER_MAIN_H
@@ -0,0 +1,29 @@
#pragma once
#include <dbghelp.h>
/*
typedef struct _MINIDUMP_EXCEPTION_INFORMATION
{
DWORD ThreadId;
PEXCEPTION_POINTERS ExceptionPointers;
BOOL ClientPointers;
} MINIDUMP_EXCEPTION_INFORMATION, *PMINIDUMP_EXCEPTION_INFORMATION;
typedef enum _MINIDUMP_TYPE
{
MiniDumpNormal = 0x00000000,
MiniDumpWithDataSegs = 0x00000001,
MiniDumpWithFullMemory = 0x00000002,
MiniDumpWithHandleData = 0x00000004,
MiniDumpFilterMemory = 0x00000008,
MiniDumpScanMemory = 0x00000010,
MiniDumpWithUnloaded = 0x00000020,
MiniDumpWithIndirectlyReferencedMemory = 0x00000040,
MiniDumpFilterModulePaths = 0x00000080,
MiniDumpWithProcessThreadData = 0x00000100,
MiniDumpWithPrivateReadWriteMemory = 0x00000200,
MiniDumpWithoutOptionalData = 0x00000400,
MiniDumpWithFullMemoryInfo = 0x00000800,
MiniDumpWithThreadInfo = 0x00001000,
MiniDumpWithCodeSegs = 0x00002000
} MINIDUMP_TYPE;
*/
@@ -0,0 +1,96 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by gen_crasher.rc
//
#define IDS_ERROR_FEEDBACK 1
#define IDS_UNKNOWN 2
#define IDS_LOADED_OK 3
#define IDS_UNABLE_TO_LOAD 4
#define IDS_NOT_FOUND 5
#define IDS_UNABLE_TO_SAVE_SETTINGS 6
#define IDS_SAVE_ERROR 7
#define IDS_SELECT_FOLDER_FOR_ERROR_INFO 8
#define IDD_CRASHDLG 101
#define IDD_CONFIG 102
#define IDD_DLG_SMTP 103
#define IDC_CHK_CREATEDMP 1003
#define IDC_EDT_DMPPATH 1004
#define IDC_EDT_DMPNAME 1004
#define IDC_BTN_DMPPATH 1005
#define IDC_BTN_PATH 1005
#define IDC_CMB_DMPTYPE 1006
#define IDC_CHK_CREATELOG 1007
#define IDC_EDT_LOGPATH 1008
#define IDC_EDT_LOGNAME 1008
#define IDC_BUTTON2 1009
#define IDC_BTN_LOGPATH 1009
#define IDC_EDT_PATH 1009
#define IDC_RB_USECLIENT 1010
#define IDC_CHK_LOGSYSTEM 1011
#define IDC_CHK_LOGFILE 1012
#define IDC_CHK_LOGREGISTRY 1012
#define IDC_CHK_LOGMACHINE 1013
#define IDC_CHK_LOGSTACK 1013
#define IDC_CHK_RESTART 1014
#define IDC_CHK_SILENT 1015
#define IDC_CHK_SEND 1016
#define IDC_USESMTP 1017
#define IDC_RB_USESMTP 1017
#define IDC_EDT_SERVER 1018
#define IDC_EDT_ZIPNAME 1018
#define IDC_EDT_USER 1019
#define IDC_EDT_PWD 1020
#define IDC_CHK_LOGMODULE 1021
#define IDC_EDT_PORT 1021
#define IDC_GRP_DUMP 1022
#define IDC_GRP_GENERAL 1023
#define IDC_GRP_LOG 1024
#define IDC_GRP_EMAIL 1025
#define IDC_LBL_SERVER 1026
#define IDC_GRP_ZIP 1026
#define IDC_LBL_USER 1027
#define IDC_LBL_PWD 1028
#define IDC_LBL_DMPTYPE 1029
#define IDC_LBL_PORT 1029
#define IDC_LBL_DMPPATH 1030
#define IDC_LBL_DMPNAME 1030
#define IDC_LBL_LOGPATH 1031
#define IDC_LBL_LOGNAME 1031
#define IDC_LBL_OSVERSION_CAPTION 1032
#define IDC_LBL_DLLPATH_CAPTION 1033
#define IDC_LBL_DLLVERSION_CAPTION 1034
#define IDC_LBL_OSVERSION 1035
#define IDC_LBL_DLLPATH 1036
#define IDC_LBL_DLLVERSION 1037
#define IDC_CHK_COMPRESS 1040
#define IDC_BTN_SMTP 1041
#define IDC_LBL_ZIPNAME 1042
#define IDC_LBL_PATH 1043
#define IDC_LBL_INFO 1045
#define IDC_LBL_STEP 1046
#define IDC_BMP_LOGO 1047
#define IDC_EDIT1 1048
#define IDC_EDT_ADDRESS 1048
#define IDC_CHK_AUTH 1049
#define IDC_GRP_AUTH 1050
#define IDC_LBL_ADDRESS 1051
#define IDC_GRP_AUTH2 1052
#define IDC_TITLELBL 1101
#define IDC_WORKLBL 1102
#define IDC_PROGRESS1 1103
#define IDC_PRG_COLLECT 1103
#define IDC_PROGRESS2 1104
#define IDC_PROGRESS3 1105
#define IDS_NULLSOFT_ERROR_FEEDBACK 65534
#define IDS_STRING107 65535
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 108
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1052
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
@@ -0,0 +1,251 @@
#include ".\settings.h"
#include <shlwapi.h>
#include <strsafe.h>
Settings::Settings(void)
{
dumpPath = NULL;
logPath = NULL;
smtpServer = NULL;
smtpUser = NULL;
smtpPwd = NULL;
path = NULL;
smtpAddress = NULL;
updatePath = TRUE;
createDMP = TRUE;
createLOG = TRUE;
autoRestart = FALSE;
silentMode = TRUE;
sendData = TRUE;
zipData = TRUE;
zipPath = NULL;
sendByClient = TRUE;
sendBySMTP = FALSE;
smtpPort = 25;
smtpAuth = TRUE;
dumpType = 0;
logSystem = TRUE;
logRegistry = TRUE;
logStack = TRUE;
logModule = TRUE;
}
Settings::~Settings(void)
{
if (dumpPath) free(dumpPath);
if (logPath) free(logPath);
if (smtpServer) free(smtpServer);
if (smtpUser) free(smtpUser);
if (smtpPwd) free(smtpPwd);
if (path) free(path);
if (smtpAddress) free(smtpAddress);
}
void Settings::SetPath(wchar_t *iniPath)
{
size_t size = lstrlen(iniPath);
if (path) free(path);
path = NULL;
path = (wchar_t*)malloc((size + 1) * sizeof(wchar_t));
StringCchCopy(path, size+1, iniPath);
wchar_t iniFile[MAX_PATH*2] = {0};
size += 14 * sizeof(wchar_t);
CreateDirectory(iniPath, NULL);
StringCchPrintf(iniFile, size, L"%s\\feedback.ini", iniPath);
cfg.SetIniFile(iniFile);
}
const wchar_t* Settings::GetPath(void)
{
return path;
}
BOOL Settings::Load(void)
{
if (!cfg.IsFileExist()) return FALSE;
cfg.SetSection(L"General");
updatePath = cfg.ReadInt(L"UpdatePath", TRUE);
if (updatePath) return FALSE;
createDMP = cfg.ReadInt(L"CreateDmp", TRUE);
createLOG = cfg.ReadInt(L"CreateLog", TRUE);
autoRestart = cfg.ReadInt(L"AutoRestart", FALSE);
silentMode = cfg.ReadInt(L"SilentMode", TRUE);
sendData = cfg.ReadInt(L"SendData", TRUE);
cfg.SetSection(L"Send");
sendByClient = cfg.ReadInt(L"UseClient", TRUE);
sendBySMTP = cfg.ReadInt(L"UseSMTP", FALSE);
smtpPort = cfg.ReadInt(L"Port", 25);
smtpAuth = cfg.ReadInt(L"ReqAuth", TRUE);
CreateStrCopy(&smtpAddress, cfg.ReadStringW(L"Address", L"bug@winamp.com"));
CreateStrCopy(&smtpServer, cfg.ReadStringW(L"Server", NULL));
CreateStrCopy(&smtpUser, cfg.ReadStringW(L"User", NULL));
CreateStrCopy(&smtpPwd, cfg.ReadStringW(L"Pwd", NULL));
cfg.SetSection(L"Zip");
zipData = cfg.ReadInt(L"ZipData", TRUE);
CreateStrCopy(&zipPath, cfg.ReadStringW(L"Path", NULL));
cfg.SetSection(L"Dump");
dumpType = cfg.ReadInt(L"Type", 0);
CreateStrCopy(&dumpPath, cfg.ReadStringW(L"Path", NULL));
cfg.SetSection(L"Log");
logSystem = cfg.ReadInt(L"System", TRUE);
logRegistry = cfg.ReadInt(L"Registry", TRUE);
logStack = cfg.ReadInt(L"Stack", TRUE);
logModule = cfg.ReadInt(L"Module", TRUE);
CreateStrCopy(&logPath, cfg.ReadStringW(L"Path", NULL));
return TRUE;
}
void Settings::CreateStrCopy(wchar_t **dest, const wchar_t* source)
{
if (*dest) free(*dest);
*dest = NULL;
if (source)
{
size_t len = lstrlen(source) + 1;
*dest = (wchar_t*) malloc(len*sizeof(wchar_t));
StringCchCopy(*dest, len, source);
}
}
BOOL Settings::Save(void)
{
BOOL error = FALSE;
if (FALSE == cfg.SetSection(L"General")) error = TRUE;
if (FALSE == cfg.Write(L"UpdatePath", FALSE)) error = TRUE;
if (FALSE == cfg.Write(L"CreateDmp", createDMP)) error = TRUE;
if (FALSE == cfg.Write(L"CreateLog", createLOG)) error = TRUE;
if (FALSE == cfg.Write(L"AutoRestart", autoRestart)) error = TRUE;
if (FALSE == cfg.Write(L"SilentMode", silentMode)) error = TRUE;
if (FALSE == cfg.Write(L"SendData", sendData)) error = TRUE;
if (FALSE == cfg.SetSection(L"Send")) error = TRUE;
if (FALSE == cfg.Write(L"UseClient", sendByClient)) error = TRUE;
if (FALSE == cfg.Write(L"UseSMTP", sendBySMTP)) error = TRUE;
if (FALSE == cfg.Write(L"Port", smtpPort)) error = TRUE;
if (FALSE == cfg.Write(L"Server", smtpServer)) error = TRUE;
if (FALSE == cfg.Write(L"Address", smtpAddress)) error = TRUE;
if (FALSE == cfg.Write(L"ReqAuth", smtpAuth)) error = TRUE;
if (FALSE == cfg.Write(L"User", smtpUser)) error = TRUE;
if (FALSE == cfg.Write(L"Pwd", smtpPwd)) error = TRUE;
if (FALSE == cfg.SetSection(L"Zip")) error = TRUE;
if (FALSE == cfg.Write(L"ZipData", zipData)) error = TRUE;
if (FALSE == cfg.Write(L"Path", zipPath)) error = TRUE;
if (FALSE == cfg.SetSection(L"Dump")) error = TRUE;
if (FALSE == cfg.Write(L"Type", dumpType)) error = TRUE;
if (FALSE == cfg.Write(L"Path", dumpPath)) error = TRUE;
if (FALSE == cfg.SetSection(L"Log")) error = TRUE;
if (FALSE == cfg.Write(L"System", logSystem)) error = TRUE;
if (FALSE == cfg.Write(L"Registry", logRegistry)) error = TRUE;
if (FALSE == cfg.Write(L"Stack", logStack)) error = TRUE;
if (FALSE == cfg.Write(L"Module", logModule)) error = TRUE;
if (FALSE == cfg.Write(L"Path", logPath)) error = TRUE;
return !error;
}
BOOL Settings::CreateDefault(wchar_t* iniPath)
{
wchar_t temp[MAX_PATH] = {0};
int len;
createDMP = TRUE;
createLOG = TRUE;
autoRestart = FALSE;
silentMode = TRUE;
sendData = TRUE;
// zip
PathCombine(temp, iniPath, L"report.zip");
len = (int)wcslen(temp) + 1;
zipData = TRUE;
zipPath = (wchar_t*) malloc(len*2);
StringCchCopy(zipPath, len, temp);
// send
sendByClient = TRUE;
sendBySMTP = FALSE;
smtpPort = 25;
smtpAddress = (wchar_t*) malloc(32*2);
StringCchCopy(smtpAddress, 32, L"bug@winamp.com");
smtpAuth = TRUE;
smtpServer = NULL;
smtpUser = NULL;
smtpPwd = NULL;
// dump
PathCombine(temp, iniPath, L"_crash.dmp");
len = (int)wcslen(temp) + 1;
dumpType = NULL;
dumpPath = (wchar_t*) malloc(len*2);
StringCchCopy(dumpPath, len, temp);
// log
logSystem = TRUE;
logRegistry = TRUE;
logStack = TRUE;
logModule = TRUE;
PathCombine(temp, iniPath, L"_crash.log");
len = (int)wcslen(temp) + 1;
logPath = (wchar_t*) malloc(len*2);
StringCchCopy(logPath, len, temp);
return TRUE;
}
BOOL Settings::IsOk(void)
{
return (logPath != NULL && dumpPath != NULL);
}
void Settings::ClearTempData(void)
{
cfg.Write(L"Temp", L"TS", L"");
cfg.Write(L"Temp", L"LOG", L"0");
cfg.Write(L"Temp", L"DMP", L"0");
}
void Settings::WriteErrorTS(const wchar_t *time)
{
cfg.Write(L"Temp", L"TS", time);
}
void Settings::WriteLogCollectResult(BOOL result)
{
cfg.Write(L"Temp", L"LOG", result);
}
void Settings::WriteDmpCollectResult(BOOL result)
{
cfg.Write(L"Temp", L"DMP", result);
}
void Settings::WriteWinamp(const wchar_t *winamp)
{
cfg.Write(L"Temp", L"WA", winamp);
}
const wchar_t* Settings::ReadErrorTS(void)
{
return cfg.ReadStringW(L"Temp", L"TS", L"");
}
BOOL Settings::ReadLogCollectResult(void)
{
return cfg.ReadInt(L"Temp", L"LOG", 0);
}
BOOL Settings::ReadDmpCollectResult(void)
{
return cfg.ReadInt(L"Temp", L"DMP", 0);
}
const wchar_t* Settings::ReadWinamp(void)
{
return cfg.ReadStringW(L"Temp", L"WA", L"");
}
void Settings::WriteBody(const wchar_t *body)
{
cfg.Write(L"Temp", L"Body", body);
}
const wchar_t* Settings::ReadBody(void)
{
return cfg.ReadStringW(L"Temp", L"Body", L"");
}
@@ -0,0 +1,67 @@
#pragma once
#include "config.h"
class Settings
{
public:
Settings(void);
~Settings(void);
public:
void SetPath(wchar_t *iniPath);
BOOL Load(void);
BOOL Save(void);
BOOL CreateDefault(wchar_t* iniPath);
BOOL IsOk(void);
const wchar_t* GetPath(void);
protected:
void CreateStrCopy(wchar_t **dest, const wchar_t* source);
private:
ConfigW cfg;
wchar_t* path;
public:
// general
BOOL updatePath;
BOOL createDMP;
BOOL createLOG;
BOOL autoRestart;
BOOL silentMode;
BOOL sendData;
//zip
BOOL zipData;
wchar_t* zipPath;
// send
BOOL sendByClient;
BOOL sendBySMTP;
int smtpPort;
wchar_t *smtpServer;
wchar_t *smtpAddress;
BOOL smtpAuth;
wchar_t *smtpUser;
wchar_t *smtpPwd;
// dump
int dumpType;
wchar_t *dumpPath;
// log
BOOL logSystem;
BOOL logRegistry;
BOOL logStack;
BOOL logModule;
wchar_t *logPath;
// tmp
void ClearTempData(void);
void WriteErrorTS(const wchar_t *time);
void WriteLogCollectResult(BOOL result);
void WriteDmpCollectResult(BOOL result);
void WriteWinamp(const wchar_t *winamp);
void WriteBody(const wchar_t *body);
const wchar_t* ReadErrorTS(void);
BOOL ReadLogCollectResult(void);
BOOL ReadDmpCollectResult(void);
const wchar_t* ReadWinamp(void);
const wchar_t* ReadBody(void);
};
+127
View File
@@ -0,0 +1,127 @@
#include ".\smtpdlg.h"
#include ".\resource.h"
#include ".\settings.h"
#include <strsafe.h>
extern Settings settings;
void UpdateAuth(HWND hwndDlg, BOOL enabled)
{
EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_USER), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_USER), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_PWD), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_PWD), enabled);
}
BOOL CALLBACK smtpDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_INITDIALOG:
{
wchar_t num[16] = {0};
CenterDialog(hwndDlg);
SetWindowText(GetDlgItem(hwndDlg, IDC_EDT_SERVER), settings.smtpServer);
SetWindowText(GetDlgItem(hwndDlg, IDC_EDT_USER), settings.smtpUser);
SetWindowText(GetDlgItem(hwndDlg, IDC_EDT_PWD), settings.smtpPwd);
SetWindowText(GetDlgItem(hwndDlg, IDC_EDT_PORT), _itow(settings.smtpPort, num, 10));
SetWindowText(GetDlgItem(hwndDlg, IDC_EDT_ADDRESS), settings.smtpAddress);
CheckDlgButton(hwndDlg, IDC_CHK_AUTH, settings.smtpAuth);
UpdateAuth(hwndDlg, settings.smtpAuth);
break;
}
case WM_DESTROY:
{
wchar_t buf[1024] = {0};
int len;
if (settings.smtpServer) free(settings.smtpServer);
settings.smtpServer = NULL;
len = GetWindowText(GetDlgItem(hwndDlg, IDC_EDT_SERVER), buf, 1024);
if (len)
{
settings.smtpServer = (wchar_t*)malloc((len + 1)*2);
StringCchCopy(settings.smtpServer, len+1, buf);
}
len = GetWindowText(GetDlgItem(hwndDlg, IDC_EDT_PORT), buf, 1024);
if (len) settings.smtpPort = _wtoi(buf);
if (settings.smtpUser) free(settings.smtpUser);
settings.smtpUser = NULL;
len = GetWindowText(GetDlgItem(hwndDlg, IDC_EDT_USER), buf, 1024);
if (len)
{
settings.smtpUser = (wchar_t*)malloc((len + 1)*2);
StringCchCopy(settings.smtpUser, len+1, buf);
}
if (settings.smtpPwd) free(settings.smtpPwd);
settings.smtpPwd = NULL;
len = GetWindowText(GetDlgItem(hwndDlg, IDC_EDT_PWD), buf, 1024);
if (len)
{
settings.smtpPwd = (wchar_t*)malloc((len + 1)*2);
StringCchCopy(settings.smtpPwd, len+1, buf);
}
if (settings.smtpAddress) free(settings.smtpAddress);
settings.smtpAddress = NULL;
len = GetWindowText(GetDlgItem(hwndDlg, IDC_EDT_ADDRESS), buf, 1024);
if (len)
{
settings.smtpAddress = (wchar_t*)malloc((len + 1)*2);
StringCchCopy(settings.smtpAddress, len+1, buf);
}
settings.smtpAuth = (SendMessage(GetDlgItem(hwndDlg, IDC_CHK_AUTH), BM_GETCHECK, 0,0) == BST_CHECKED);
settings.Save();
break;
}
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_CHK_AUTH:
UpdateAuth(hwndDlg, (SendMessage((HWND) lParam, BM_GETCHECK, 0,0) == BST_CHECKED));
break;
case IDCANCEL:
EndDialog(hwndDlg, 0);
break;
}
break;
}
return FALSE;
}
void CenterDialog(HWND hwndDlg)
{
HWND hwndOwner;
RECT rc, rcDlg, rcOwner;
if ((hwndOwner = GetParent(hwndDlg)) == NULL)
{
hwndOwner = GetDesktopWindow();
}
GetWindowRect(hwndOwner, &rcOwner);
GetWindowRect(hwndDlg, &rcDlg);
CopyRect(&rc, &rcOwner);
// Offset the owner and dialog box rectangles so that
// right and bottom values represent the width and
// height, and then offset the owner again to discard
// space taken up by the dialog box.
OffsetRect(&rcDlg, -rcDlg.left, -rcDlg.top);
OffsetRect(&rc, -rc.left, -rc.top);
OffsetRect(&rc, -rcDlg.right, -rcDlg.bottom);
// The new position is the sum of half the remaining
// space and the owner's original position.
SetWindowPos(hwndDlg,
HWND_TOP,
rcOwner.left + (rc.right / 2),
rcOwner.top + (rc.bottom / 2),
0, 0, // ignores size arguments
SWP_NOSIZE);
}
@@ -0,0 +1,5 @@
#pragma once
#include <windows.h>
void CenterDialog(HWND hwndDlg);
BOOL CALLBACK smtpDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
@@ -0,0 +1,39 @@
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
#include "..\..\..\Winamp/buildType.h"
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,16,0,0
PRODUCTVERSION WINAMP_PRODUCTVER
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Winamp SA"
VALUE "FileDescription", "Winamp General Purpose Plug-in"
VALUE "FileVersion", "1,16,0,0"
VALUE "InternalName", "Nullsoft Winamp Error Feedback Plug-in"
VALUE "LegalCopyright", "Copyright © 2005-2023 Winamp SA"
VALUE "LegalTrademarks", "Nullsoft and Winamp are trademarks of Winamp SA"
VALUE "OriginalFilename", "gen_crasher.dll"
VALUE "ProductName", "Winamp"
VALUE "ProductVersion", STR_WINAMP_PRODUCTVER
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END