mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-18 04:05:46 -04:00
Initial community commit
This commit is contained in:
364
Src/Plugins/General/gen_crasher/feedback/email/SendEmail.cpp
Normal file
364
Src/Plugins/General/gen_crasher/feedback/email/SendEmail.cpp
Normal file
@ -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;
|
||||
}
|
38
Src/Plugins/General/gen_crasher/feedback/email/SendEmail.h
Normal file
38
Src/Plugins/General/gen_crasher/feedback/email/SendEmail.h
Normal file
@ -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
|
119
Src/Plugins/General/gen_crasher/feedback/feedback.rc
Normal file
119
Src/Plugins/General/gen_crasher/feedback/feedback.rc
Normal file
@ -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
|
||||
|
30
Src/Plugins/General/gen_crasher/feedback/feedback.sln
Normal file
30
Src/Plugins/General/gen_crasher/feedback/feedback.sln
Normal file
@ -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
|
321
Src/Plugins/General/gen_crasher/feedback/feedback.vcproj
Normal file
321
Src/Plugins/General/gen_crasher/feedback/feedback.vcproj
Normal file
@ -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>
|
253
Src/Plugins/General/gen_crasher/feedback/feedback.vcxproj
Normal file
253
Src/Plugins/General/gen_crasher/feedback/feedback.vcxproj
Normal file
@ -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>
|
79
Src/Plugins/General/gen_crasher/feedback/main.cpp
Normal file
79
Src/Plugins/General/gen_crasher/feedback/main.cpp
Normal file
@ -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 <20> 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);
|
||||
}
|
19
Src/Plugins/General/gen_crasher/feedback/main.h
Normal file
19
Src/Plugins/General/gen_crasher/feedback/main.h
Normal file
@ -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
|
36
Src/Plugins/General/gen_crasher/feedback/manifest.xml
Normal file
36
Src/Plugins/General/gen_crasher/feedback/manifest.xml
Normal file
@ -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>
|
163
Src/Plugins/General/gen_crasher/feedback/operations.cpp
Normal file
163
Src/Plugins/General/gen_crasher/feedback/operations.cpp
Normal file
@ -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
|
||||
);
|
||||
}
|
29
Src/Plugins/General/gen_crasher/feedback/resource.h
Normal file
29
Src/Plugins/General/gen_crasher/feedback/resource.h
Normal file
@ -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
|
134
Src/Plugins/General/gen_crasher/feedback/silent.cpp
Normal file
134
Src/Plugins/General/gen_crasher/feedback/silent.cpp
Normal file
@ -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;
|
||||
}
|
320
Src/Plugins/General/gen_crasher/feedback/smtp/Base64.cpp
Normal file
320
Src/Plugins/General/gen_crasher/feedback/smtp/Base64.cpp
Normal file
@ -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;
|
||||
}
|
63
Src/Plugins/General/gen_crasher/feedback/smtp/Base64.h
Normal file
63
Src/Plugins/General/gen_crasher/feedback/smtp/Base64.h
Normal file
@ -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_)
|
1468
Src/Plugins/General/gen_crasher/feedback/smtp/Smtp.cpp
Normal file
1468
Src/Plugins/General/gen_crasher/feedback/smtp/Smtp.cpp
Normal file
File diff suppressed because it is too large
Load Diff
245
Src/Plugins/General/gen_crasher/feedback/smtp/Smtp.h
Normal file
245
Src/Plugins/General/gen_crasher/feedback/smtp/Smtp.h
Normal file
@ -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_)
|
39
Src/Plugins/General/gen_crasher/feedback/version.rc2
Normal file
39
Src/Plugins/General/gen_crasher/feedback/version.rc2
Normal file
@ -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 <20> 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
|
2915
Src/Plugins/General/gen_crasher/feedback/xzip/XZip.cpp
Normal file
2915
Src/Plugins/General/gen_crasher/feedback/xzip/XZip.cpp
Normal file
File diff suppressed because it is too large
Load Diff
324
Src/Plugins/General/gen_crasher/feedback/xzip/XZip.h
Normal file
324
Src/Plugins/General/gen_crasher/feedback/xzip/XZip.h
Normal file
@ -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
|
Reference in New Issue
Block a user