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;
}
Example #2
0
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;
}
Example #3
0
int main(int argc, char* argv[])
{

	GString strNetworkConnections(32767);
	GetNetworkConnections(strNetworkConnections,NET_FLAG_REDUCE_INFO|NET_FLAG_NO_UDP);

	GString strWanIP, strNoWanIPError; 
	ExternalIP(&strWanIP, &strNoWanIPError);

	CSmtp mail;
	GString strMailServer("smtp.gmail.com");


	// ------- GMail TLS --------
	// Note about GMail - login, then under "My Account" go to "Sign-In & Security" and set "Allow Less Secure Apps": to ON.  
	// This enables TLS and non-google apps(not insecure apps).  AOL, HotMail, and Yahoo enable the SMTP over TLS relay for
	// the paid email account services with no ads and higher mail/data limits.
	//
	mail.SetSMTPServer(strMailServer,587);
	mail.SetSecurityType(USE_TLS);

#include <"Do.not.compile">  // add your own Gmail account in the next two lines..... then delete this line   (and set the recipient)

	// Note about GMail - login, then under "My Account" go to "Sign-In & Security" and set "Allow Less Secure Apps": to ON.  
//	mail.SetLogin("*****@*****.**");
//	mail.SetPassword("MyOwnPassword");


	mail.SetSenderName("My Application");
	mail.SetSenderMail("*****@*****.**");
	mail.SetReplyTo("*****@*****.**");
	
	GString strSubject(g_strThisHostName);
	strSubject << " Stats";
	mail.SetSubject(strSubject);

	mail.AddRecipient("*****@*****.**");   //<---------------------------------------------------------- Who to send the email to
//	mail.AddRecipient("*****@*****.**");


  	mail.SetXPriority(XPRIORITY_NORMAL);
  	mail.SetXMailer("Professional (v7.77) Pro");
  	

	mail.AddMsgLine("----------------------------Wan IP----------------------------------------");
	mail.AddMsgLine(strWanIP);

	mail.AddMsgLine("----------------------Network Interfaces----------------------------------");
	GString strThisHost("Host:");
	strThisHost << g_strThisHostName;
	mail.AddMsgLine(strThisHost);
	GStringList lstBoundIPAddresses;
	InternalIPs(&lstBoundIPAddresses);
	GStringIterator it2(&lstBoundIPAddresses);
	while(it2())
	{
		mail.AddMsgLine(it2++);
	}

	mail.AddMsgLine("----------------------Network Connections----------------------------------");
	GStringList l("\n",strNetworkConnections); // each row divided by "\n"
	GStringIterator it(&l);
	while(it())
	{
		mail.AddMsgLine(it++);
	}


	mail.AddMsgLine("------------------------Processes-------------------------------------------");
	GString strRunningProcessData;
	GetProcessList( &strRunningProcessData );
	GStringList lstProcess("\n",strRunningProcessData); // each row divided by "\n"
	GStringIterator itP(&lstProcess);
	while(itP())
	{
		//mail.AddMsgLine(itP++);								// write it out -  raw
		GProcessListRow *pRow = new GProcessListRow(itP++);		// or use the already written code to parse process information

		GString strProcess;										// write onluy the data we want into this GString 
		strProcess << "pid:" << pRow->strPID << "   " << pRow->strName  << "     [" << pRow->strBinaryPath << "]";
		mail.AddMsgLine(strProcess);							// then write it out - formatted.
	}
	
  	//mail.AddAttachment("../test1.jpg");
  	//mail.AddAttachment("c:\\test2.exe");
	//mail.AddAttachment("c:\\test3.txt");
	mail.Send();



	return 0;
}