⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 myudpi~1.cpp

📁 一百个病毒的源代码 包括熊猫烧香等 极其具有研究价值
💻 CPP
字号:
#include "stdafx.h"

#include "MyUdpInfo.h"

/////////////////////////////////////////////////////////////////////////////
// CMyUdpInfo Contruction

CMyUdpInfo::CMyUdpInfo()
{
	// auto reset, initially reset
	m_hEvent_Kill = CreateEvent(NULL, FALSE, FALSE, NULL); 

	// manual reset, initially set
	m_hEvent_Killed = CreateEvent(NULL, TRUE, TRUE, NULL); 

	// auto reset, initially reset
	m_hEvent_GetParametersDone = CreateEvent(NULL, FALSE, FALSE, NULL);

	for(int i=0;i<100;i++)
		m_baMessageShowing[i] = FALSE;
}

CMyUdpInfo::~CMyUdpInfo()
{
	// Free the events
	CloseHandle(m_hEvent_Kill);
	CloseHandle(m_hEvent_Killed);
	CloseHandle(m_hEvent_GetParametersDone);
}

BOOL CMyUdpInfo::AddressValid()
{
	CStringArray csa;
	SplitAddress(csa);
	int tmp;

	for(int i=0;i<4;i++)
	{
		if(csa[i].IsEmpty())
		{
			return FALSE;
		}
		else
		{
			tmp = atoi(LPCTSTR(csa[i]));
			if((tmp<1) || (tmp>254))
			{
				return FALSE;
			}
		}
	}

	return TRUE;
}

BOOL CMyUdpInfo::AddressBlank()
{
	CStringArray csa;
	SplitAddress(csa);
	if( csa[0].IsEmpty() && csa[1].IsEmpty() && csa[2].IsEmpty() && csa[3].IsEmpty() )
		return TRUE;
	else
		return FALSE;
}

void CMyUdpInfo::SplitAddress(CStringArray& AddIt)
{
	// initialize the variables
	CString		 newCString = m_csAddress;
	CString		 tmpCString = "";
	CString		 AddCString = "";

	int pos1 = 0;
	int pos = 0;
	int indexNow = 0;

	AddIt.RemoveAll();
	AddIt.Add("");
	AddIt.Add("");
	AddIt.Add("");
	AddIt.Add("");

	CString Deliminator = "."; 

	// do this loop as long as you have a deliminator
	do {
		// set to zero
		pos1 = 0;
		// position of deliminator starting at pos1 (0)
		pos = newCString.Find(Deliminator, pos1);
		// if the deliminator is found...
		if ( pos != -1 ) 
		{
			// load a new var with the info left
			// of the position
			CString AddCString = newCString.Left(pos);

			AddIt.SetAt(indexNow, AddCString);
			indexNow++;

			// make a copy of the of this var. with the info
			// right of the deliminator
			tmpCString = newCString.Mid(pos + Deliminator.GetLength());
			
			// reset this var with new info
			newCString = tmpCString;
		}
	} while ( pos != -1 );
	
	AddIt.SetAt(indexNow, newCString);

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -