// DynamicServer.cpp : DLL _xZkqqHx_iDeBiDhGiDiKiDfAiBfLiDfGiDiHiDjDjHhAiCmMiDeHiDjDiDgHiDiK_xHqqkZx_ _xZkqqHx_iDhMiDeDiDjDiDgHiCpAjCoIiLgAiClFiCnMiClHiBeC_xHqqkZx_
//

#include "stdafx.h"
#include "resource.h"		// For IDS_RESOURCE_VERSION.
#include "UtilStr.h"		// For FFLoadWString.
#include "UtilErr.h"		// For FFMessageBox.
#include "DynamicServer.h"	// This header.

// DynamicServer_xZkqqHx_iCmMiDgFiBfLiDhFiDiLiDhEiDeAiDeDiDiLiNfMjBkC_xHqqkZx_
// 
// (xxx)_xZkqqHx_iCmNiDgGiDeCiDiMiDeOiDgHiDiKiBeB_xHqqkZx_[xxx]_xZkqqHx_iCmNiDhEiDeAiDeDiDiLiCpAjFfMiClHiBeC_xHqqkZx_
// 
// 
//   _xZkqqHx_iEjPiEjP_xHqqkZx_(TopGroup)_xZkqqHx_iEjPiEkGiEjP_xHqqkZx_[0.ddix] _xZkqqHx_iBkJ_xHqqkZx_"_xZkqqHx_iDgFiBfLiDhFiDiL_xHqqkZx_0"_xZkqqHx_iCmMiDeDiDjDiDgGiDgCiDeOiDfIiDhEiDeAiDeDiDiLiBeC_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_
//                   _xZkqqHx_iEkFiEjP_xHqqkZx_[0.ddtb] _xZkqqHx_iBkJ_xHqqkZx_"_xZkqqHx_iDgFiBfLiDhFiDiL_xHqqkZx_0"_xZkqqHx_iCmMiDgGiBfLiDfOiDhEiDeAiDeDiDiLiBeC_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_
//                   _xZkqqHx_iEkFiEjP_xHqqkZx_[1.ddix] _xZkqqHx_iBkJ_xHqqkZx_"_xZkqqHx_iDgFiBfLiDhFiDiL_xHqqkZx_1"_xZkqqHx_iCmMiDeDiDjDiDgGiDgCiDeOiDfIiDhEiDeAiDeDiDiLiBeC_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_
//                   _xZkqqHx_iEkFiEjP_xHqqkZx_[1.ddtb] _xZkqqHx_iBkJ_xHqqkZx_"_xZkqqHx_iDgFiBfLiDhFiDiL_xHqqkZx_1"_xZkqqHx_iCmMiDgGiBfLiDfOiDhEiDeAiDeDiDiLiBeC_xHqqkZx_
//                   _xZkqqHx_iBeG_xHqqkZx_
//                   _xZkqqHx_iBeG_xHqqkZx_
//                   _xZkqqHx_iEkFiEjP_xHqqkZx_[n.ddix]
//                   _xZkqqHx_iEkA_xHqqkZx_
//                   _xZkqqHx_iEkFiEjP_xHqqkZx_[n.ddtb]
//                   _xZkqqHx_iEkA_xHqqkZx_
//                   _xZkqqHx_iEkFiEjP_xHqqkZx_(0)_xZkqqHx_iEjPiEkGiEjP_xHqqkZx_[0.ddix] _xZkqqHx_iBkJ_xHqqkZx_"_xZkqqHx_iDgFiBfLiDhFiDiL_xHqqkZx_0-0"_xZkqqHx_iCmMiDeDiDjDiDgGiDgCiDeOiDfIiDhEiDeAiDeDiDiLiBeC_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_       _xZkqqHx_iEkA_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_       _xZkqqHx_iEkFiEjP_xHqqkZx_[0.ddtb] _xZkqqHx_iBkJ_xHqqkZx_"_xZkqqHx_iDgFiBfLiDhFiDiL_xHqqkZx_0-0"_xZkqqHx_iCmMiDgGiBfLiDfOiDhEiDeAiDeDiDiLiBeC_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_       _xZkqqHx_iEkA_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_       _xZkqqHx_iEkFiEjP_xHqqkZx_[1.ddix] _xZkqqHx_iBkJ_xHqqkZx_"_xZkqqHx_iDgFiBfLiDhFiDiL_xHqqkZx_0-1"_xZkqqHx_iCmMiDeDiDjDiDgGiDgCiDeOiDfIiDhEiDeAiDeDiDiLiBeC_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_       _xZkqqHx_iEkA_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_       _xZkqqHx_iEkFiEjP_xHqqkZx_[1.ddtb] _xZkqqHx_iBkJ_xHqqkZx_"_xZkqqHx_iDgFiBfLiDhFiDiL_xHqqkZx_0-1"_xZkqqHx_iCmMiDgGiBfLiDfOiDhEiDeAiDeDiDiLiBeC_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_       _xZkqqHx_iBeG_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_       _xZkqqHx_iBeG_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_       _xZkqqHx_iEkFiEjP_xHqqkZx_[n.ddix]
//                   _xZkqqHx_iEkA_xHqqkZx_       _xZkqqHx_iEkA_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_       _xZkqqHx_iEkFiEjP_xHqqkZx_[n.ddtb]
//                   _xZkqqHx_iEkA_xHqqkZx_       _xZkqqHx_iBeG_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_
//                   _xZkqqHx_iEkFiEjP_xHqqkZx_(1)_xZkqqHx_iEjPiEkGiBgD_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_       _xZkqqHx_iBeG_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_
//                   _xZkqqHx_iEkFiEjP_xHqqkZx_(2)_xZkqqHx_iEjPiEkGiEjP_xHqqkZx_(0)_xZkqqHx_iEjPiEkGiBgD_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_       _xZkqqHx_iBeG_xHqqkZx_       _xZkqqHx_iBeG_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_       _xZkqqHx_iBeG_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_       _xZkqqHx_iEkFiEjP_xHqqkZx_(4)_xZkqqHx_iEjPiEkGiBgD_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_       _xZkqqHx_iBeG_xHqqkZx_       _xZkqqHx_iBeG_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_                _xZkqqHx_iBeG_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_                _xZkqqHx_iEkFiEjP_xHqqkZx_(3)_xZkqqHx_iEjPiEkGiBgD_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_                _xZkqqHx_iBeG_xHqqkZx_       _xZkqqHx_iBeG_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_                         _xZkqqHx_iBeG_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_                         _xZkqqHx_iEkFiEjP_xHqqkZx_[5.ddix] _xZkqqHx_iBkJ_xHqqkZx_"_xZkqqHx_iDgFiBfLiDhFiDiL_xHqqkZx_2-4-3-5"_xZkqqHx_iCmMiDeDiDjDiDgGiDgCiDeOiDfIiDhEiDeAiDeDiDiLiBeC_xHqqkZx_.
//                   _xZkqqHx_iEkA_xHqqkZx_                         _xZkqqHx_iEkA_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_                         _xZkqqHx_iEkFiEjP_xHqqkZx_[5.ddtb] _xZkqqHx_iBkJ_xHqqkZx_"_xZkqqHx_iDgFiBfLiDhFiDiL_xHqqkZx_2-4-3-5"_xZkqqHx_iCmMiDgGiBfLiDfOiDhEiDeAiDeDiDiLiBeC_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_                         _xZkqqHx_iBeG_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_
//                   _xZkqqHx_iEkFiEjP_xHqqkZx_(n)_xZkqqHx_iEjPiEkGiBgD_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_       _xZkqqHx_iBeG_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_
//                   _xZkqqHx_iEkFiEjP_xHqqkZx_(.own)_xZkqqHx_iEjPiEkGiEjP_xHqqkZx_[$0$.k] _xZkqqHx_iBkJ_xHqqkZx_"_xZkqqHx_iDgFiBfLiDhFiDiL_xHqqkZx_0"_xZkqqHx_iCmMiPiKjHeMiMkAiDhEiDeAiDeDiDiLiBeC_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_          _xZkqqHx_iEkA_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_          _xZkqqHx_iEkFiEjP_xHqqkZx_[$0$0$.k] _xZkqqHx_iBkJ_xHqqkZx_"_xZkqqHx_iDgFiBfLiDhFiDiL_xHqqkZx_0-0"_xZkqqHx_iCmMiPiKjHeMiMkAiDhEiDeAiDeDiDiLiBeC_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_          _xZkqqHx_iEkA_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_          _xZkqqHx_iEkFiEjP_xHqqkZx_[$0$1$.k] _xZkqqHx_iBkJ_xHqqkZx_"_xZkqqHx_iDgFiBfLiDhFiDiL_xHqqkZx_0-1"_xZkqqHx_iCmMiPiKjHeMiMkAiDhEiDeAiDeDiDiLiBeC_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_          _xZkqqHx_iEkA_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_          _xZkqqHx_iEkFiEjP_xHqqkZx_[$2$4$3$5$.k] _xZkqqHx_iBkJ_xHqqkZx_"_xZkqqHx_iDgFiBfLiDhFiDiL_xHqqkZx_2-4-3-5"_xZkqqHx_iCmMiPiKjHeMiMkAiDhEiDeAiDeDiDiLiBeC_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_          _xZkqqHx_iEkA_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_          _xZkqqHx_iEkFiEjP_xHqqkZx_[PPPP-PPPP-PPPP-PPPP-PPPP.$0$0$] _xZkqqHx_iBkJ_xHqqkZx_"_xZkqqHx_iDgFiBfLiDhFiDiL_xHqqkZx_0-0"_xZkqqHx_iCmMiPiKjHeMiOnCiDhEiDeAiDeDiDiLiBeC_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_          _xZkqqHx_iEkA_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_          _xZkqqHx_iEkFiEjP_xHqqkZx_[QQQQ-QQQQ-QQQQ-QQQQ-QQQQ.$0$1$] _xZkqqHx_iBkJ_xHqqkZx_"_xZkqqHx_iDgFiBfLiDhFiDiL_xHqqkZx_0-1"_xZkqqHx_iCmMiPiKjHeMiOnCiDhEiDeAiDeDiDiLiBeC_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_          _xZkqqHx_iEkA_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_          _xZkqqHx_iEkFiEjP_xHqqkZx_[RRRR-RRRR-RRRR-RRRR-RRRR.$0$1$] _xZkqqHx_iBkJ_xHqqkZx_"_xZkqqHx_iDgFiBfLiDhFiDiL_xHqqkZx_0-1"_xZkqqHx_iCmMiPiKjHeMiOnCiDhEiDeAiDeDiDiLiBeC_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_          _xZkqqHx_iEkA_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_          _xZkqqHx_iEkFiEjP_xHqqkZx_[SSSS-SSSS-SSSS-SSSS-SSSS.$2$4$3$5$] _xZkqqHx_iBkJ_xHqqkZx_"_xZkqqHx_iDgFiBfLiDhFiDiL_xHqqkZx_2-4-3-5"_xZkqqHx_iCmMiPiKjHeMiOnCiDhEiDeAiDeDiDiLiBeC_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_          _xZkqqHx_iBeG_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_
//                   _xZkqqHx_iEkFiEjP_xHqqkZx_(.req)_xZkqqHx_iEjPiEkGiEjP_xHqqkZx_($)-_xZkqqHx_iEjP_xHqqkZx_[x] _xZkqqHx_iBkJ_xHqqkZx_"_xZkqqHx_iDgHiDgCiDhGiDePiDiLiBfLiDhG_xHqqkZx_"_xZkqqHx_iCmMiJpAjFpKjHhGiLiBiDhEiDeAiDeDiDiLiBeC_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_          _xZkqqHx_iEkA_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_          _xZkqqHx_iEkFiEjP_xHqqkZx_($0$)_xZkqqHx_iEjP_xHqqkZx_[x] _xZkqqHx_iBkJ_xHqqkZx_"_xZkqqHx_iDePiDiLiBfLiDhG_xHqqkZx_0"_xZkqqHx_iCmMiJpAjFpKjHhGiLiBiDhEiDeAiDeDiDiLiBeC_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_          _xZkqqHx_iEkA_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_          _xZkqqHx_iEkFiEjP_xHqqkZx_($1$)_xZkqqHx_iEjP_xHqqkZx_[x] _xZkqqHx_iBkJ_xHqqkZx_"_xZkqqHx_iDePiDiLiBfLiDhG_xHqqkZx_1"_xZkqqHx_iCmMiJpAjFpKjHhGiLiBiDhEiDeAiDeDiDiLiBeC_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_          _xZkqqHx_iBeG_xHqqkZx_
//                   _xZkqqHx_iEkA_xHqqkZx_
//                   _xZkqqHx_iEkEiEjP_xHqqkZx_(.rcv)_xZkqqHx_iEjPiEkGiEjP_xHqqkZx_[~1_x.m] _xZkqqHx_iBkJ_xHqqkZx_"_xZkqqHx_iDgHiDiJiDjDiDfFiDeOiDfGiDiHiDjD_xHqqkZx_A"_xZkqqHx_iCmMiJpBjFjMiDhEiDeAiDeDiDiLiBeC_xHqqkZx_
//                               _xZkqqHx_iEkA_xHqqkZx_
//                               _xZkqqHx_iEkFiEjP_xHqqkZx_[~2_x.m] _xZkqqHx_iBkJ_xHqqkZx_"_xZkqqHx_iDgHiDiJiDjDiDfFiDeOiDfGiDiHiDjD_xHqqkZx_B"_xZkqqHx_iCmMiJpBjFjMiDhEiDeAiDeDiDiLiBeC_xHqqkZx_
//                               _xZkqqHx_iEkA_xHqqkZx_
//                               _xZkqqHx_iEkFiEjP_xHqqkZx_[~3_x.m] _xZkqqHx_iBkJ_xHqqkZx_"_xZkqqHx_iDgHiDiJiDjDiDfFiDeOiDfGiDiHiDjD_xHqqkZx_C"_xZkqqHx_iCmMiJpBjFjMiDhEiDeAiDeDiDiLiBeC_xHqqkZx_
//                               _xZkqqHx_iBeG_xHqqkZx_
// 
// 

// _xZkqqHx_iDfEiBfLiDgPiBfLiCmMiDgPiBfLiDfHiDiHiDjDiBeCiDiKiDfMiBfLiDfI_xHqqkZx_ID_xZkqqHx_iCkKjFmPiNfIiCmJiCmIiCoJiPoKiNiHiCmJiCmNjFmPiNfIiClHiCoJiClBiCmGiBeC_xHqqkZx_
#define FD_SERVER_VERSION	L"4.1"

static FCRegData s_reg;
FCRegData* g_pReg = &s_reg;

static HANDLE s_hModule = NULL;
//----- 06.04.25 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ ()-----
// _xZkqqHx_iDiKiDfMiBfLiDfI_xHqqkZx_DLL_xZkqqHx_iCmMiDeDiDjDiDfIiDfOiDjDiDfIiBeC_xHqqkZx_
static HINSTANCE s_hResInstance = NULL;
//----- 06.04.25 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ ()-----

CPoint operator - (const CPoint& pt1, const CPoint& pt2)
{
	return CPoint(pt1.x - pt2.x, pt1.y - pt2.y);
}

CRect operator & (const CRect& rt1, const CRect& rt2)
{
	CRect rt0;
	if (LinearOverlap(rt0.left, rt0.right, rt1.left, rt1.right, rt2.left, rt2.right) &&
		LinearOverlap(rt0.top, rt0.bottom, rt1.top, rt1.bottom, rt2.top, rt2.bottom))
		return rt0;
	else
		return CRect(0,0,0,0);
}

BOOL WString::LoadString (UINT nID)
{
	int iLen = 100;
	TCHARVector vBuff;
	do
	{
		vBuff.resize(iLen);
// 06.04.25 Fukushiro M. 1_xZkqqHx_iNhDjFmPiNfI_xHqqkZx_ ()
//		iLen = ::LoadString(HINSTANCE(s_hModule),
		iLen = ::LoadString(s_hResInstance,
							nID,
							&vBuff[0],
							vBuff.size());
	} while (iLen == vBuff.size());
	operator = (TStrToWStr(&vBuff[0]));
	return TRUE;
} // WString::LoadString.

BOOL APIENTRY DllMain (	HANDLE hModule,
						DWORD  ul_reason_for_call,
						LPVOID lpReserved)
{
    switch (ul_reason_for_call)
	{
		case DLL_PROCESS_ATTACH:
			s_hModule = hModule;
//----- 06.04.25 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ ()-----
			// _xZkqqHx_iDiKiDfMiBfLiDfI_xHqqkZx_DLL_xZkqqHx_iCmMiDeDiDjDiDfIiDfOiDjDiDfIiBeC_xHqqkZx_
			s_hResInstance = ::LoadLibrary(_T("DynamicServerRes.dll"));
			if (FFLoadWString(IDS_RESOURCE_VERSION) != FD_SERVER_VERSION)
			//----- _xZkqqHx_iDiKiDfMiBfLiDfI_xHqqkZx_DLL_xZkqqHx_iCmMiDgPiBfLiDfHiDiHiDjDiCmGiDfEiBfLiDgPiBfLiDgPiBfLiDfHiDiHiDjDiCkKiInJiCmIiCoJiPoKiNiH_xHqqkZx_ -----
			{
				// _xZkqqHx_iDeHiDiJiBfLiDiBiDgCiDfKiBfLiDfHiBeCiDiKiDfMiBfLiDfI_xHqqkZx_ID_xZkqqHx_iCkKiOgHiCkGiCmIiCkCiClNiCnPiBeBjFlGiOjKjHpBiCpAjClMiPjBiCkLiBeC_xHqqkZx_
				FFMessageBox(L"Incorrect version of resource DLL");
				return FALSE;
			}

//----- 06.04.25 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ ()-----
			break;
		case DLL_THREAD_ATTACH:
		case DLL_THREAD_DETACH:
			break;
		case DLL_PROCESS_DETACH:
			s_hModule = NULL;
//----- 06.04.25 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ ()-----
			if ((HINSTANCE)HINSTANCE_ERROR < s_hResInstance)
			{
				::FreeLibrary(s_hResInstance);
				s_hResInstance = NULL;
			}
//----- 06.04.25 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ ()-----
			break;
    }
    return TRUE;
}

