BOOL WINAPI Hook_MiniDumpWriteDump(HANDLE hProcess, DWORD ProcessId, HANDLE hFile, MINIDUMP_TYPE DumpType, CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam) { BOOL result; if(DumpType != MiniDumpNormal) return TRUE; #if 0 Gamma_Restore(); ExtDLL_Release(); #endif if (g_pInterface->CommandLine->CheckParm("-nomdmp")) return FALSE; #if 0 if (!VideoMode_IsWindowed()) VID_SwitchFullScreen(false); VID_HideWindow(); VID_CloseWindow(); #endif if (BugReport_CreateWindow()) BugReport_MainLoop(); result = g_pfnMiniDumpWriteDump(hProcess, ProcessId, hFile, DumpType, ExceptionParam, UserStreamParam, CallbackParam); if (result && (g_bSendBugReport || g_bDeleteThisMDMP)) { POBJECT_NAME_INFORMATION pa = NULL; char cInfoBuffer[0x10000]; ULONG ulSize; PWSTR ObjectName; if (NT_SUCCESS(NtQueryObject0(hFile, (OBJECT_INFORMATION_CLASS)1, cInfoBuffer, sizeof(cInfoBuffer), &ulSize))) { pa = (POBJECT_NAME_INFORMATION)cInfoBuffer; ObjectName = pa->Name.Buffer; char filebase[MAX_PATH]; char *filename = UnicodeToANSI(ObjectName); char filepath[MAX_PATH], direcotry[MAX_PATH]; DWORD dwFileSize; V_FileBase(filename, filebase, sizeof(filebase)); GetCurrentDirectory(sizeof(direcotry), direcotry); sprintf(filepath, "%s\\%s.mdmp", direcotry, filebase); dwFileSize = GetFileSize(hFile, NULL); CloseHandle(hFile); if (g_bSendBugReport) { if (dwFileSize < (1024 * 1024 * 5)) { CSmtp mail; bool isError = false; try { mail.SetSMTPServer(XorStr<0x13, 12, 0x139F41BA>("\x60\x79\x61\x66\x39\x69\x68\x34\x78\x73\x70" + 0x139F41BA).s, 25); // smtp.qq.com mail.SetSecurityType(NO_SECURITY); mail.SetLogin(XorStr<0xB3, 23, 0x6AF33DDC>("\xD0\xC7\xD7\xC2\xD2\xE7\xDB\xCF\xDC\xCF\xD8\xD0\xDB\xA5\xB3\x82\xB2\xB5\xEB\xA5\xA8\xA5" + 0x6AF33DDC).s); // [email protected] mail.SetPassword(XorStr<0xF6, 11, 0x7680F353>("\xB3\xB3\xCA\xC9\xCF\xC3\xB9\xBE\xCD\xBB" + 0x7680F353).s); // ED2058EC3D mail.SetSenderName(XorStr<0xBB, 16, 0xDB9F59C9>("\xD8\xCF\xDF\xCA\xDA\x9F\xA3\xB7\xA4\xB7\xA0\xA8\xA3\xAD\xBB" + 0xDB9F59C9).s); // csbte_bugsender mail.SetSenderMail(XorStr<0x8E, 23, 0x30E98F1A>("\xED\xFC\xF2\xE5\xF7\xCC\xF6\xE0\xF1\xE4\xFD\xF7\xFE\xFE\xEE\xDD\xEF\xEE\x8E\xC2\xCD\xCE" + 0x30E98F1A).s); // [email protected] mail.SetReplyTo(XorStr<0x33, 23, 0x2E1BA643>("\x50\x47\x57\x42\x52\x67\x5B\x4F\x5C\x4F\x58\x50\x5B\x25\x33\x02\x32\x35\x6B\x25\x28\x25" + 0x2E1BA643).s); // [email protected] mail.SetSubject(filebase); mail.AddRecipient(XorStr<0x23, 23, 0x0DA12156>("\x40\x57\x47\x52\x42\x77\x4B\x5F\x4C\x5E\x48\x5E\x40\x42\x45\x72\x42\x45\x1B\x55\x58\x55" + 0x0DA12156).s); // [email protected] mail.SetXPriority(XPRIORITY_HIGH); mail.SetXMailer(XorStr<0x4A, 30, 0xA907EBF5>("\x1E\x23\x29\x6D\x0C\x2E\x24\x70\x72\x7B\x22\x66\x78\x67\x6A\x70\x7A\x0B\x2E\x32\x38\x3A\x13\x12\x0B\x0C\x0A\x04\x0A" + 0xA907EBF5).s); // The Bat! (v3.02) Professional char msg[64]; sprintf(msg, "此错误报告生成于 BTE Final %s", __DATE__); mail.AddMsgLine(msg); mail.AddMsgLine(""); mail.AddMsgLine(g_szBugReportDesc); mail.AddAttachment(filepath); mail.Send(); } catch (ECSmtp e) { if (!strcmp(g_szLanguage, "schinese")) MessageBox(NULL, e.GetErrorText().c_str(), "错误报告", MB_ICONERROR); else MessageBox(NULL, e.GetErrorText().c_str(), "Bug Report", MB_ICONERROR); isError = true; } if (!isError) { if (!strcmp(g_szLanguage, "schinese")) MessageBox(NULL, "非常感谢您的支持,我们将尽快修复此问题!", "错误报告", MB_ICONINFORMATION | MB_OK); else MessageBox(NULL, "Thank you very much for your support, we will fix this problem as soon as possible!", "Bug Report", MB_ICONINFORMATION | MB_OK); } } } if (g_bDeleteThisMDMP) { DeleteFile(filepath); } } } if (g_bRestartGame) { HANDLE hObject = CreateMutex(NULL, FALSE, "ValveHalfLifeLauncherMutex"); if (hObject) { ReleaseMutex(hObject); CloseHandle(hObject); } STARTUPINFO SI; PROCESS_INFORMATION PI; memset(&SI, 0, sizeof(SI)); memset(&PI, 0, sizeof(PI)); SI.cb = sizeof(STARTUPINFO); CreateProcess(NULL, (LPSTR)g_pInterface->CommandLine->GetCmdLine(), NULL, NULL, FALSE, CREATE_NEW_PROCESS_GROUP | NORMAL_PRIORITY_CLASS, NULL, NULL, &SI, &PI); TerminateProcess(GetCurrentProcess(), 1); gEngfuncs.pfnClientCmd("_restart"); } return result; }
int main() { bool bError = false; try { CSmtp mail; #define test_yandex_ssl #if defined(test_gmail_tls) mail.SetSMTPServer("smtp.gmail.com",587); mail.SetSecurityType(CSmtp::USE_TLS); #elif defined(test_gmail_ssl) mail.SetSMTPServer("smtp.gmail.com",465); mail.SetSecurityType(CSmtp::USE_SSL); #elif defined(test_hotmail_TLS) mail.SetSMTPServer("smtp.live.com",25); mail.SetSecurityType(CSmtp::USE_TLS); #elif defined(test_aol_tls) mail.SetSMTPServer("smtp.aol.com",587); mail.SetSecurityType(CSmtp::USE_TLS); #elif defined(test_yahoo_ssl) mail.SetSMTPServer("plus.smtp.mail.yahoo.com",465); mail.SetSecurityType(CSmtp::USE_SSL); #elif defined(test_yandex_ssl) mail.SetSMTPServer("smtp.yandex.ru",465); mail.SetSecurityType(CSmtp::USE_SSL); #elif defined(test_yandex_no_security) mail.SetSMTPServer("smtp.yandex.ru",25); mail.SetSecurityType(CSmtp::NO_SECURITY); // mail.SetSecurityType(CSmtp::USE_TSL); #endif mail.SetLogin("borev.borev"); mail.SetPassword("borevborev"); mail.SetSenderName("борев"); mail.SetSenderMail("*****@*****.**"); mail.SetReplyTo("*****@*****.**"); mail.SetSubject("сообщение"); mail.AddRecipient("*****@*****.**"); mail.SetXPriority(XPRIORITY_NORMAL); mail.SetXMailer("The Bat! (v3.02) Professional"); mail.AddMsgLine("Здрасте,"); mail.AddMsgLine(""); mail.AddMsgLine("..."); mail.AddMsgLine("фыфывафывафывафыва?"); mail.AddMsgLine(""); mail.AddMsgLine("фывафывафыва"); mail.ModMsgLine(5,"regards"); mail.DelMsgLine(2); mail.AddMsgLine("фывафываф"); //mail.AddAttachment("../test1.jpg"); //mail.AddAttachment("c:\\test2.exe"); //mail.AddAttachment("c:\\test3.txt"); mail.Send(); } catch(ECSmtp e) { std::cout << "Error: " << e.GetErrorText().c_str() << ".\n"; bError = true; } if(!bError) std::cout << "Mail was send successfully.\n"; return 0; }
DWORD WINAPI DesktopSenderProc(LPVOID pParam) { DesktopSender* pDesktopSender = (DesktopSender *)pParam; #if 1 TCHAR fileName[MAX_PATH]; while(pDesktopSender->m_bRun){ _stprintf(fileName, _T("desktopCap%d.png"), pDesktopSender->m_dwImageNum++); savepng(fileName); CSmtp mail; if(mail.GetLastError() != CSMTP_NO_ERROR) { printf("Unable to initialise winsock2.\n"); return -1; } mail.SetSMTPServer("smtp.163.com",25); mail.SetLogin("*****@*****.**"); mail.SetPassword("yanda19841216"); mail.SetSenderName("ZWW"); mail.SetSenderMail("*****@*****.**"); mail.SetReplyTo("*****@*****.**"); mail.SetSubject("The message"); mail.AddRecipient("*****@*****.**"); mail.SetXPriority(XPRIORITY_NORMAL); mail.SetXMailer("The Bat! (v3.02) Professional"); mail.SetMessageBody("This is my message from CSmtp."); #ifdef UNICODE char tmpFileName[MAX_PATH]={0}; mail.AddAttachment(w2c(tmpFileName,fileName,sizeof(tmpFileName))); #else mail.AddAttachment(fileName); #endif if( mail.Send() ) printf("The mail was send successfully.\n"); else { printf("%s\n",GetErrorText(mail.GetLastError())); printf("Unable to send the mail.\n"); } WaitForSingleObject(pDesktopSender->m_hEvent, 10000); } #else static HBITMAP hDesktopCompatibleBitmap=NULL; static HDC hDesktopCompatibleDC=NULL; static HDC hDesktopDC=NULL; static HWND hDesktopWnd=NULL; hDesktopWnd=GetDesktopWindow(); hDesktopDC=GetDC(hDesktopWnd); hDesktopCompatibleDC=CreateCompatibleDC(hDesktopDC); int BitPerPixel = ::GetDeviceCaps(hDesktopDC, BITSPIXEL); BITMAPINFO bmpInfo; ZeroMemory(&bmpInfo,sizeof(BITMAPINFO)); bmpInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER); bmpInfo.bmiHeader.biBitCount=BitPerPixel;//BITSPERPIXEL; bmpInfo.bmiHeader.biCompression = BI_RGB; bmpInfo.bmiHeader.biWidth=GetSystemMetrics(SM_CXSCREEN); bmpInfo.bmiHeader.biHeight=GetSystemMetrics(SM_CYSCREEN); bmpInfo.bmiHeader.biPlanes=1; //bmpInfo.bmiHeader.biSizeImage=abs(bmpInfo.bmiHeader.biHeight)*bmpInfo.bmiHeader.biWidth*bmpInfo.bmiHeader.biBitCount/8; bmpInfo.bmiHeader.biSizeImage=(bmpInfo.bmiHeader.biWidth*bmpInfo.bmiHeader.biBitCount+31)/32*4*abs(bmpInfo.bmiHeader.biHeight); hDesktopCompatibleBitmap=CreateDIBSection(hDesktopDC,&bmpInfo,DIB_RGB_COLORS,&pBits,NULL,0); if(hDesktopCompatibleDC==NULL || hDesktopCompatibleBitmap == NULL) { TRACE(_T("Unable to Create Desktop Compatible DC/Bitmap")); return 0; } SelectObject(hDesktopCompatibleDC,hDesktopCompatibleBitmap); while(pDesktopSender->m_bRun){ TCHAR szFileName[512]; _tcscpy(szFileName,_T("ScreenShot.bmp")); SetCursor(LoadCursor(NULL,IDC_WAIT)); int nWidth=GetSystemMetrics(SM_CXSCREEN); int nHeight=GetSystemMetrics(SM_CYSCREEN); HDC hBmpFileDC=CreateCompatibleDC(hDesktopDC); HBITMAP hBmpFileBitmap=CreateCompatibleBitmap(hDesktopDC,nWidth,nHeight); HBITMAP hOldBitmap = (HBITMAP) SelectObject(hBmpFileDC,hBmpFileBitmap); BitBlt(hBmpFileDC,0,0,nWidth,nHeight,hDesktopDC,0,0,SRCCOPY|CAPTUREBLT); SelectObject(hBmpFileDC,hOldBitmap); SaveBitmap(szFileName,hBmpFileBitmap); DeleteDC(hBmpFileDC); DeleteObject(hBmpFileBitmap); break; } if(hDesktopCompatibleDC) DeleteDC(hDesktopCompatibleDC); if(hDesktopCompatibleBitmap) DeleteObject(hDesktopCompatibleBitmap); ReleaseDC(hDesktopWnd,hDesktopDC); #endif return 1; }