h_sw_registro/include/registration_api.h

49 lines
1.6 KiB
C
Raw 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
2025-08-05 15:32:23 +00:00
// --- Core Functions ---
// Gets the raw machine code.
2025-07-26 02:32:02 +00:00
REGISTRATION_API const char* GetMachineCode();
2025-08-05 15:32:23 +00:00
// Validates the license file.
// @return: 0=success, 1=failure, 2=expired.
REGISTRATION_API int ValidateLicenseFile();
2025-07-26 02:32:02 +00:00
2025-08-05 15:32:23 +00:00
// Generates a license file from a provided machine code.
// @param machine_code: The machine code to use.
// @param expiration_date: A date string in "YYYY-MM-DD" format.
// @return: 0=success, 1=failure.
REGISTRATION_API int GenerateLicenseFileFromCode(const char* machine_code, const char* expiration_date);
2025-07-26 02:32:02 +00:00
2025-08-05 15:32:23 +00:00
// --- New Encryption/Decryption API ---
2025-07-26 02:32:02 +00:00
2025-08-05 15:32:23 +00:00
// Generates a dynamic, 32-character encrypted code from the machine code.
// The returned string is managed by the DLL and should not be freed by the caller.
REGISTRATION_API const char* GenerateEncryptedCode();
2025-07-26 02:32:02 +00:00
2025-08-05 15:32:23 +00:00
// Decrypts a 32-character code to get the original machine code.
// @param encrypted_code: The 32-character hex string to decrypt.
// @param decrypted_machine_code: A buffer to store the null-terminated result.
// @param buffer_size: The size of the provided buffer.
// @return: 0 on success, 1 on failure (e.g., invalid format, bad length).
REGISTRATION_API int DecryptCodeAndGetMachineCode(const char* encrypted_code, char* decrypted_machine_code, int buffer_size);
2025-07-26 02:32:02 +00:00
#ifdef __cplusplus
}
#endif
#endif // REGISTRATION_API_H