h_sw_registro/include/registration_api.h

50 lines
1.5 KiB
C
Raw Permalink Normal View History

2025-07-26 02:32:02 +00:00
#ifndef REGISTRATION_API_H
#define REGISTRATION_API_H
#ifdef REGISTRATION_EXPORTS
#define REGISTRATION_API __declspec(dllexport)
#else
#define REGISTRATION_API __declspec(dllimport)
#endif
#include <string>
#ifdef __cplusplus
extern "C" {
#endif
// 获取原始机器码
REGISTRATION_API const char* GetMachineCode();
// 获取加密后的许可证密钥
REGISTRATION_API const char* GetLicenseKey();
// 验证许可证密钥 (离线)
// @param key: 要验证的密钥
// @return: 0=成功, 1=失败, 2=过期
REGISTRATION_API int ValidateLicenseOffline(const char* key);
// 设置离线许可证的有效期
// @param expiration_date: "YYYY-MM-DD" 格式的日期字符串
REGISTRATION_API void SetOfflineExpiration(const char* expiration_date);
// 生成许可证文件
// @param expiration_date: "YYYY-MM-DD" 格式的日期字符串
// @return: 0=成功, 1=失败
REGISTRATION_API int GenerateLicenseFile(const char* expiration_date);
// 从提供的机器码生成许可证文件
// @param machine_code: 要使用的机器码
// @param expiration_date: "YYYY-MM-DD" 格式的日期字符串
// @return: 0=成功, 1=失败
REGISTRATION_API int GenerateLicenseFileFromCode(const char* machine_code, const char* expiration_date);
// 验证许可证文件
// @return: 0=成功, 1=失败, 2=过期
REGISTRATION_API int ValidateLicenseFile();
#ifdef __cplusplus
}
#endif
#endif // REGISTRATION_API_H