Port PythonExceptionSender and install it at boot as 40250 Main does

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-09-30 12:31:04 +09:00
co-authored by Claude Opus 5.5
parent 3dfb09df92
commit ff71726ff0
6 changed files with 128 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
// stdafx.cpp : source file that includes just the standard includes
// scriptLib.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "StdAfx.h"
void SetExceptionSender(IPythonExceptionSender * pkExceptionSender)
{
g_pkExceptionSender = pkExceptionSender;
}
@@ -0,0 +1,67 @@
#include "StdAfx.h"
#include "PythonExceptionSender.h"
void CPythonExceptionSender::Send()
{
//DWORD dwCRC32 = GetCaseCRC32(m_strExceptionString.c_str(), m_strExceptionString.length());
//if (m_kSet_dwSendedExceptionCRC.end() != m_kSet_dwSendedExceptionCRC.find(dwCRC32))
// return;
//TraceError("%s", m_strExceptionString.c_str());
//SOCKET s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
//if (s==INVALID_SOCKET)
//{
// Tracef(" CPythonExceptionSender::Send() - Invalid Socket");
//}
//DWORD arg = 1;
//ioctlsocket(s, FIONBIO, &arg); // Non-blocking mode
//char szServerAddr[256];
//int nServerPort;
//strncpy(szServerAddr, "211.105.222.20", sizeof(szServerAddr)-1);
//nServerPort=LocaleService_GetPythonErrorReportPort();
//
//sockaddr_in sa;
//sa.sin_family = AF_INET;
//sa.sin_port = htons(nServerPort);
//sa.sin_addr.s_addr = inet_addr(szServerAddr);
//if (connect(s,(sockaddr*)&sa,sizeof(sa)))
// return;
//int number_ticket=0;
//if (recv(s,(char*)&number_ticket,4,0))
// return;
//int length=m_strExceptionString.length();
//int total=0;
//int ret=0;
//int count = 100;
//while(count--)
//{
// // send plain text
// ret = send(s,(char*)(&m_strExceptionString[0])+total,length-total,0);
//
// if (ret<0)
// break;
// total+=ret;
// if (total>=length)
// break;
//}
//closesocket(s);
//m_kSet_dwSendedExceptionCRC.insert(dwCRC32);
}
CPythonExceptionSender::CPythonExceptionSender()
{
}
CPythonExceptionSender::~CPythonExceptionSender()
{
}
@@ -0,0 +1,13 @@
#pragma once
class CPythonExceptionSender : public IPythonExceptionSender
{
public:
CPythonExceptionSender();
virtual ~CPythonExceptionSender();
void Send();
protected:
std::set<DWORD> m_kSet_dwSendedExceptionCRC;
};