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

📄 config.cpp

📁 COM 组建的开发
💻 CPP
字号:
// Config.cpp: implementation of the CConfig class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "resource.h"
#include "Config.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CConfig::CConfig()
{
	
}

CConfig::~CConfig()
{

}
// 判断Des算法是否可用 [5/6/2008 By willing]
DWORD CConfig::DesIsEnable()
{
	DWORD dwRe = 0;// 默认返回值为0 [5/6/2008 By willing]
	int nRe = this->GetDwordRegValue(REG_PATCH,_T("DES"),dwRe);
	if (0 > nRe)
	{
		// 获取注册表值失败 [5/6/2008 By willing]
		return nRe;
	}
	// 保证dwRe只有两种取值 [5/6/2008 By willing]
	if (0 != dwRe)
	{
		dwRe = 1;
	}
	return dwRe;
}
// 判断3DES算法是否可用 [5/6/2008 By willing]
DWORD CConfig::Des3IsEnable()
{
	DWORD dwRe = 0;// 默认返回值为0 [5/6/2008 By willing]
	int nRe = this->GetDwordRegValue(REG_PATCH,_T("3DES"),dwRe);
	if (0 > nRe)
	{
		// 获取注册表值失败 [5/6/2008 By willing]
		return nRe;
	}
	// 保证dwRe只有两种取值 [5/6/2008 By willing]
	if (0 != dwRe)
	{
		dwRe = 1;
	}

	return dwRe;
}
// 获取加密类型 [5/6/2008 By willing]
DWORD CConfig::GetEncryptType()
{
	DWORD dwRe = 0;// 默认返回值为0 [5/6/2008 By willing]
	int nRe = this->GetDwordRegValue(REG_PATCH,_T("ENCTYPE"),dwRe);
	if (0 > nRe)
	{
		// 获取注册表值失败 [5/6/2008 By willing]
		return nRe;
	}
	if ((0 != dwRe)&&(1 != dwRe)&&(2 != dwRe))
	{
		return -5;
	}

	return dwRe;
}
// 获取密码的最小长度 [5/6/2008 By willing]
DWORD CConfig::GetPwdLen()
{
	DWORD dwRe = 0;// 默认返回值为0 [5/6/2008 By willing]
	int nRe = this->GetDwordRegValue(REG_PATCH,_T("PWDLEN"),dwRe);
	if (0 > nRe)
	{
		// 获取注册表值失败 [5/6/2008 By willing]
		return nRe;
	}
	// 正常的取值范围为4~30 [5/6/2008 By willing]
	if (dwRe < 4)
	{
		return -5;
	}
	if (dwRe > 30)
	{
		return -6;
	}

	return dwRe;
}
// 判断该该模块的功能是否被禁用 [5/7/2008 By willing]
BOOL CConfig::IsUse()
{
	DWORD dwRe = 0;// 默认返回值为0 [5/6/2008 By willing]
	int nRe = this->GetDwordRegValue(REG_PATCH,_T("ISUSE"),dwRe);
	if (0 > nRe)
	{
		// 获取注册表值失败 [5/6/2008 By willing]
		return FALSE;
	}
	// 保证dwRe只有两种取值 [5/6/2008 By willing]
	if (0 != dwRe)
	{
		return TRUE;
	}

	return FALSE;
}

⌨️ 快捷键说明

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