#0020: 修复CLMS验证问题,同类型只检测第一个
This commit is contained in:
@@ -76,12 +76,12 @@ CLM_GetExpirationDateFor m_pCLM_GetExpirationDateFor;
|
||||
|
||||
BOOL CheckLicense()
|
||||
{
|
||||
m_hCLM = LoadLibrary(_T("CLMTool.dll"));
|
||||
m_hCLM = LoadLibrary(_T("MORCODE.dll"));
|
||||
if (m_hCLM)
|
||||
{
|
||||
if (g_pLogger)
|
||||
{
|
||||
g_pLogger->SendAndFlushWithTime(L"CLMTool.dll Load Success");
|
||||
g_pLogger->SendAndFlushWithTime(L"MORCODE.dll Load Success");
|
||||
}
|
||||
|
||||
//Production
|
||||
@@ -104,7 +104,7 @@ BOOL CheckLicense()
|
||||
//////////////////////////////////////////////////////////////////1登陆验证
|
||||
BOOL res = FALSE;
|
||||
//Metus软件
|
||||
char* strLogin = "rsWoGvmINesgabljzJZpTmMRGMLyKxFsaxpLRZSnpsujYlboLaKwSINrFbtddgMYgsXkCLwxfVUALwfQcxWEbvZZHjrrYwRkNCBMsjfxeKyannbTIVxsrQvLUWraoysNJFcYJrYnCSabWnxgezkDbvwHLksNqdWyvrfHqKeBLyyVyVYROgizPCqVaRQLkNrSROgvbAqShNZNuzKGHjOLYiwLaXnPKgvHcXuNeNLyuGMFeDnpiipTVDrvJaoNXDTq";
|
||||
char* strLogin = "vravnhNYybkmDkHDPKhVIwbHMoqHktgqWHFkBTOUsZLLVLwaAOkPIFFoVffUnSqUkCApSxrWQmsKvYCdVUpZLOhuHshKFbUPezYYbyQCgUoHrFOaaLVSosAapdVagrfFSqDUzxCvVuSJodxkjBiCJdRUfhCIfyRzjLdTfkxtUHPYUHyQbzOaJFvdSbzLihYmuhLHFNUSbERcAFbnrvNQtZOCUSUnHFcySXzTbfqTgzeaWQrjoSTzEUYDkEUmqusV";
|
||||
res = m_pCLM_Login(strLogin);
|
||||
if (!res)
|
||||
{
|
||||
@@ -164,4 +164,48 @@ BOOL CheckLicense()
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
BOOL CheckLicense2()
|
||||
{
|
||||
// 获取当前系统时间
|
||||
time_t now = time(0);
|
||||
tm localTime;
|
||||
localtime_s(&localTime, &now);
|
||||
|
||||
int currentYear = 1900 + localTime.tm_year;
|
||||
int currentMonth = 1 + localTime.tm_mon;
|
||||
int currentDay = localTime.tm_mday;
|
||||
|
||||
// 设定的到期时间
|
||||
int expirationYear = 205; // 设定的到期年份
|
||||
int expirationMonth = 3; // 设定的到期月份
|
||||
int expirationDay = 15; // 设定的到期日期
|
||||
|
||||
// 计算当前时间和到期时间的差距(以天为单位)
|
||||
tm expirationTime = { 0 };
|
||||
expirationTime.tm_year = expirationYear - 1900;
|
||||
expirationTime.tm_mon = expirationMonth - 1;
|
||||
expirationTime.tm_mday = expirationDay;
|
||||
|
||||
time_t expiration = mktime(&expirationTime);
|
||||
double difference = difftime(expiration, now) / (60 * 60 * 24); // 转换为天数
|
||||
|
||||
// 判断是否在一个月内
|
||||
if (difference <= 30 && difference >= 0)
|
||||
{
|
||||
if (g_pLogger)
|
||||
{
|
||||
g_pLogger->SendAndFlushWithTime(L"授权通过:到期时间在一个月内");
|
||||
}
|
||||
return TRUE; // 授权通过
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g_pLogger)
|
||||
{
|
||||
g_pLogger->SendAndFlushWithTime(L"授权不通过:到期时间超过一个月");
|
||||
}
|
||||
return FALSE; // 授权不通过
|
||||
}
|
||||
}
|
||||
@@ -2,5 +2,7 @@
|
||||
#define CLMS_H_INCLUDED_
|
||||
|
||||
BOOL CheckLicense();
|
||||
BOOL CheckLicense2(); //启动时间判断
|
||||
|
||||
|
||||
#endif
|
||||
@@ -60,6 +60,7 @@
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;HSI_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$ (ProjectDir)</AdditionalIncludeDirectories>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
||||
@@ -12,5 +12,5 @@
|
||||
#define HSI_VERSION_REVNUM
|
||||
#define HSI_VERSION_BUILD_DATE _T(__DATE__ )
|
||||
#define HSI_VERSION_BUILD_TIME _T(__TIME__ )
|
||||
#define HSI_FILE_DESCRIPTION "2025.02.18 / 17:09 "
|
||||
#define HSI_FILE_CSDESCRIPTION _T("2025.02.18 / 17:09 ")
|
||||
#define HSI_FILE_DESCRIPTION "2025.02.20 / 9:50 "
|
||||
#define HSI_FILE_CSDESCRIPTION _T("2025.02.20 / 9:50 ")
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user