|
|
/*********************************************************************
|
|
|
*文件说明: license验证模块
|
|
|
*作者: logos
|
|
|
*日期: 2018/09/01
|
|
|
*修改日志: 2018/09/01 logos CREATE
|
|
|
|
|
|
***********************************************************************/
|
|
|
#pragma once
|
|
|
#ifndef DLL_INCLUDE_HELPER_H
|
|
|
#define DLL_INCLUDE_HELPER_H
|
|
|
|
|
|
#ifndef EXPORT_C
|
|
|
#define EXPORT_C extern "C"
|
|
|
#endif
|
|
|
|
|
|
#ifndef WINAPI
|
|
|
#define WINAPI __stdcall
|
|
|
#endif
|
|
|
|
|
|
/****************************************************
|
|
|
*Function: 初始化模块
|
|
|
*Intput: NULL
|
|
|
*Output: NULL
|
|
|
*Return: 成功返回0
|
|
|
******************************************************/
|
|
|
EXPORT_C int WINAPI helper_init();
|
|
|
|
|
|
/****************************************************
|
|
|
*Function: 释放模块 资源
|
|
|
*Intput: NULL
|
|
|
*Output: NULL
|
|
|
*Return: 成功返回0
|
|
|
******************************************************/
|
|
|
EXPORT_C int WINAPI helper_deinit();
|
|
|
|
|
|
/****************************************************
|
|
|
*Function: 从文件重新加载license 默认data\\license.dat
|
|
|
*Intput: file 变量文件目录 <256字节
|
|
|
*Output: NULL
|
|
|
*Return: 成功返回0,失败返回错误码
|
|
|
******************************************************/
|
|
|
EXPORT_C int WINAPI helper_load(const char* file = 0);
|
|
|
|
|
|
/****************************************************
|
|
|
*Function: 保存当前license到文件 默认data\\license.dat
|
|
|
*Intput: file 变量文件目录 <256字节
|
|
|
*Output: NULL
|
|
|
*Return: 成功返回0,失败返回错误码
|
|
|
******************************************************/
|
|
|
EXPORT_C int WINAPI helper_save(const char* file = 0);
|
|
|
|
|
|
/****************************************************
|
|
|
*Function: 注册license
|
|
|
*Intput: pszregsn 注册码/验证码
|
|
|
*Output: NULL
|
|
|
*Return: 成功返回0,失败返回错误码
|
|
|
******************************************************/
|
|
|
EXPORT_C int WINAPI helper_regist(const char* pszregsn);
|
|
|
|
|
|
/****************************************************
|
|
|
*Function: 按照当前注册参数自动注册 -- 此接口需要输入密码
|
|
|
*Intput: pwd 接口密码 123
|
|
|
*Output: NULL
|
|
|
*Return: 成功返回0,失败返回错误码
|
|
|
******************************************************/
|
|
|
EXPORT_C int WINAPI helper_auto_regist(const char* pwd);
|
|
|
|
|
|
/****************************************************
|
|
|
*Function: 获取license 注册码
|
|
|
*Intput: pwd 接口密码
|
|
|
nmon 注册月数 0标识永久
|
|
|
*Output: regsn 注册码 256位
|
|
|
*Return: 成功返回0,失败返回错误码
|
|
|
*PS: 需调用其它接口先设置好相关序列号
|
|
|
******************************************************/
|
|
|
EXPORT_C int WINAPI helper_get_regist_sn(char* regsn, const char* pwd, int nmon = 0);
|
|
|
|
|
|
/****************************************************
|
|
|
*Function: 将一个注册码生成license.dat保存到文件 默认data\\license.dat
|
|
|
*Intput: pszregsn 注册码
|
|
|
file 变量文件目录 <256字节
|
|
|
*Output: NULL
|
|
|
*Return: 成功返回0,失败返回错误码
|
|
|
******************************************************/
|
|
|
EXPORT_C int WINAPI helper_make_license(const char* pszregsn, const char* file = 0);
|
|
|
|
|
|
/****************************************************
|
|
|
*Function: 检测license是否有效 返回0成功
|
|
|
*Intput: NULL
|
|
|
*Output: NULL
|
|
|
*Return: 成功返回0,失败返回错误码
|
|
|
*PS: 应用层可一直调用,内部会判断1分钟检测一次
|
|
|
******************************************************/
|
|
|
EXPORT_C int WINAPI helper_check();
|
|
|
|
|
|
/****************************************************
|
|
|
*Function: 获取license是否有效 1有效 0无效
|
|
|
*Intput: NULL
|
|
|
*Output: NULL
|
|
|
*Return: 1有效 0无效
|
|
|
******************************************************/
|
|
|
EXPORT_C int WINAPI helper_is_valid();
|
|
|
|
|
|
/****************************************************
|
|
|
*Function: 获取license 有效截止日期
|
|
|
*Intput: NULL
|
|
|
*Output: NULL
|
|
|
*Return: format:20181212 0无效
|
|
|
******************************************************/
|
|
|
EXPORT_C int WINAPI helper_valid_date();
|
|
|
|
|
|
/****************************************************
|
|
|
*Function: 获取license 注册日期
|
|
|
*Intput: NULL
|
|
|
*Output: NULL
|
|
|
*Return: format:20181212 0无效
|
|
|
******************************************************/
|
|
|
EXPORT_C int WINAPI helper_reg_date();
|
|
|
|
|
|
/****************************************************
|
|
|
*Function: 获取license 获取动态码
|
|
|
*Intput: NULL
|
|
|
*Output: NULL
|
|
|
*Return: 动态码8位
|
|
|
*PS: 动态码用于生成验证码
|
|
|
******************************************************/
|
|
|
EXPORT_C int WINAPI helper_dynamic_sn();
|
|
|
|
|
|
/****************************************************
|
|
|
*Function: 通过动态码获取验证码 - 6位
|
|
|
*Intput: nmon传入0标识永久 否则为月份
|
|
|
dyn 动态码 -- 8位
|
|
|
pwd 接口密码 123
|
|
|
*Output: NULL
|
|
|
*Return: 成功返回动态验证码,失败返回错误码
|
|
|
******************************************************/
|
|
|
EXPORT_C int WINAPI helper_verif_key(int nmon, int dyn, const char* pwd);
|
|
|
|
|
|
/****************************************************
|
|
|
*Function: 获取license cpu序列号
|
|
|
*Intput: NULL
|
|
|
*Output: cpu 序列号 32位
|
|
|
*Return: 成功返回0,失败返回错误码
|
|
|
******************************************************/
|
|
|
EXPORT_C int WINAPI helper_cpu_sn(char* cpu);
|
|
|
|
|
|
/****************************************************
|
|
|
*Function: 获取license hd序列号
|
|
|
*Intput: NULL
|
|
|
*Output: hd 序列号 32位
|
|
|
*Return: 成功返回0,失败返回错误码
|
|
|
******************************************************/
|
|
|
EXPORT_C int WINAPI helper_hd_sn(char* hd);
|
|
|
|
|
|
/****************************************************
|
|
|
*Function: 获取license mac序列号
|
|
|
*Intput: NULL
|
|
|
*Output: mac 序列号 32位
|
|
|
*Return: 成功返回0,失败返回错误码
|
|
|
******************************************************/
|
|
|
EXPORT_C int WINAPI helper_mac_sn(char* mac);
|
|
|
|
|
|
/****************************************************
|
|
|
*Function: 获取license 机器码通过CPU+HD+MAC生成
|
|
|
*Intput: NULL
|
|
|
*Output: sn 机器码 256位
|
|
|
*Return: 成功返回0,失败返回错误码
|
|
|
******************************************************/
|
|
|
EXPORT_C int WINAPI helper_machine_sn(char* sn);
|
|
|
|
|
|
/****************************************************
|
|
|
*Function: 设置license cpu序列号
|
|
|
*Intput: cpu 序列号 32位
|
|
|
*Output: NULL
|
|
|
*Return: 成功返回0,失败返回错误码
|
|
|
******************************************************/
|
|
|
EXPORT_C int WINAPI helper_set_cpu_sn(const char* cpu);
|
|
|
|
|
|
/****************************************************
|
|
|
*Function: 设置license hd序列号
|
|
|
*Intput: hd 序列号 32位
|
|
|
*Output: NULL
|
|
|
*Return: 成功返回0,失败返回错误码
|
|
|
******************************************************/
|
|
|
EXPORT_C int WINAPI helper_set_hd_sn(const char* hd);
|
|
|
|
|
|
/****************************************************
|
|
|
*Function: 设置license mac序列号
|
|
|
*Intput: mac 序列号 32位
|
|
|
*Output: NULL
|
|
|
*Return: 成功返回0,失败返回错误码
|
|
|
******************************************************/
|
|
|
EXPORT_C int WINAPI helper_set_mac_sn(const char* mac);
|
|
|
|
|
|
/****************************************************
|
|
|
*Function: 设置license 机器码
|
|
|
*Intput: sn 机器码 256位
|
|
|
*Output: NULL
|
|
|
*Return: 成功返回0,失败返回错误码
|
|
|
******************************************************/
|
|
|
EXPORT_C int WINAPI helper_set_machine_sn(const char* sn);
|
|
|
|
|
|
#endif //防止重复包含头文件
|