Files
PS_Dinkey/Dinkey Pro 7.6.1/Samples/C/drpf.h
2026-05-06 07:47:36 +02:00

118 lines
5.8 KiB
C

// drpf.h
// !! this file should not be modified
// NB DRPF file is:
// REMOTEINFO
// LICENCEINFO (however many are needed)
// ALGCHANGE (however many are needed)
// DATACHANGE (however many are needed) - may refer to external files.
// Remember: you only need to specify a value if you want to change it. Otherwise you
// specify the default "no change" setting. For most entries this is indicated by 0.
// However, for MaxNetUsers and LicenceNetUsers it is "-2" because 0 is a valid value to change to.
#pragma pack (push,1) // so it is byte-aligned
typedef struct REMOTEINFO {
char Header[4]; // Should be set to "DRPF" = DinkeyRemote Parameter File
unsigned int Version; // version of this structure - currently 2
char ProdCode[12];
unsigned int DongleNumber;
int UpdateNumber;
char Notes[256]; // user-defined notes
unsigned int NumLicences;
unsigned int NumAlgs; // number of algs to set (incl r/w alg)
unsigned int NumDataChanges; // number of data change blocks specified
unsigned int DataAreaSize; // -1 = increase as necessary. specifies the new size of the data area
int PerLicence; // 0 = no change, 1 = per licence net users, 2 = per product net users
int MaxNetUsers; // product net users, unlimited = -1, no change = -2
unsigned int LastUsedDay; // Day = 0 (only) -> no change
unsigned int LastUsedMonth;
unsigned int LastUsedYear;
char DataEncKeyProdCode[12];
unsigned int ChangeCodeType; // 0 = no change, bit0 = only accept secure codes, bit1 = accept secure & short codes
int CodeType; // type of code to generate. 0 = secure code, 1 = short code
char OutputFileName[256];// name of file to output code to. Null (default) -> UpdateCode.ducf
int LockDongle; // 1 = lock dongle to user's computer
int ResetDongleLock; // 1 = reset the dongle lock so that the dongle can be locked to a new machine
} REMOTEINFO;
typedef struct LICENCEINFO {
char LicenceName[256];
unsigned int Action; // 0 = change, 1 = delete, 2 = add
unsigned int AddSetExecs; // 0 = no change to execs, 1 = add, 2 = set
int Execs; // -1 = no limit
int ExecsWarn; // 0 = remove warning, -1 = no change
int ExpiryDay; // -1 = no limit, 0 = no change
int ExpiryMonth;
int ExpiryYear;
unsigned int AddSetMaxDays; // 0 = no change, 1 = add, 2 = set
int MaxDays; // -1 = no limit
int DaysWarn; // 0 = remove warning, -1 = no change
int FeaturesFlag; // 0 = don't change features, 1 = change features
unsigned int Features; // all values OK
int LicenceNetUsers; // unlimited = -1, no change = -2
} LICENCEINFO;
typedef struct ALGCHANGE {
int alg_number; // number of algorithm to set (0 = r/w algorithm)
unsigned char algorithm[12]; // algorithm
} ALGCHANGE;
typedef struct DATACHANGE {
unsigned int type; // 1 = file, 2 = hex data, 3 = ascii, 4 = ascii null-term string
unsigned int offset; // offset in dongle data memory to write data
int length; // length of data to change
unsigned char data[256]; // data to write OR name of data file depending on which method set
} DATACHANGE;
typedef struct UPDATE_CODE_OUTPUTS {
char szShortCode[128*3]; // the update code (for short update codes only)
char szUpdateCodeFile[256]; // the output ducf that contains the update code
char szConfirmationCode[8]; // the confirmation code
} UPDATE_CODE_OUTPUTS;
typedef void *DRPF_HANDLE; // for DinkeyRemote Module API functions
#pragma pack (pop)
// constants
#define DRPF_VERSION 2 // current DRPF version
// WriteDRPF API flags
#define FLAGS_LOSE_FEATURES 1 // means that you can save the DRPF file to an earlier version even if it means losing some new features that have been currently set
// constants for drpf_format in ReadDRPFEx and WriteDRPFEx functions
#define DRPF_FORMAT_BINARY 1
#define DRPF_FORMAT_JSON 2
#define DRPF_FORMAT_JSON_MIN 3 // this value is only used with WriteDRPEx. ReadDRPFEx cannot return this value.
#define MAX_LICENCES 255 // max number of licence changes in a DRPF file (theoretically unlimited but easier if we limit it)
#define MAX_ALG_CHANGES 21 // max number of alg changes in DRPF file
#define MAX_DATA_CHANGES 127 // max number of data area changes in DRPF file
// DinkeyRemote module API declarations
#ifdef __cplusplus
extern "C" {
#endif
int WINAPI ReadDRPFEx(char *szFileDRPF, REMOTEINFO *pRemoteInfo, LICENCEINFO *pLicenceInfo, ALGCHANGE *pAlgChanges, DATACHANGE *pDataChanges, int *drpf_version, int *drpf_format);
DRPF_HANDLE WINAPI LoadDRPF(REMOTEINFO *pRemoteInfo, LICENCEINFO *pLicenceInfo, ALGCHANGE *pAlgChanges, DATACHANGE *pDataChanges, int *err_code);
DRPF_HANDLE WINAPI LoadDRPFFromFile(char *szFileDRPF, int *err_code);
int WINAPI WriteDRPFEx(DRPF_HANDLE handle, char *szFileDRPF, int drpf_format, int drpf_version, int flags);
void WINAPI UnloadDRPF(DRPF_HANDLE *handle);
int WINAPI GenerateUpdateCode(DRPF_HANDLE handle, unsigned int dongle_number, int update_number, char *ducf_file, char *logfile, UPDATE_CODE_OUTPUTS *pOutputs);
void WINAPI GetLastMessage(char *szMessage, int buffer_size, int *message_length);
int WINAPI GetLastExtendedError(void);
#ifdef __cplusplus
}
#endif