8.3.2 SecureDecodeSDK.h


   SecureDecodeSDK Header file:


You need to include the SecureDECODE SDK Header file with each file that performs the SecureDECODE action.


The file is delivered by SecureSDK package and must be included in C++ source files.


See code listing:


  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
/////////////////////////////////////////////////////////////////////////
//                                                                     
// SecureDELTA SDK :: SecureDECODE SDK Header File                     
// Part of SecureDELTA SDK v2.56 (C) agersoftware srl                  
//                                                                     
// Designed, developed and implemented by agersoftware srl and its     
// technology partner, NetLUP Xtreme Technologies srl                  
//                                                                     
// Copyright (C) 2019-2029 agersoftware srl, All Rights Reserved.      
// Portions Copyright (C) 2019-2029 NetLUP Xtreme Technologies srl.    
//                                                                     
// NOTICE:                                                             
// All information contained herein is and remains the property of     
// agersoftware srl and its suppliers or technological partners        
// NetLUP Xtreme Technologies srl                                      
//                                                                     
// INTELLECTUAL PROPERTY                                               
// The intellectual and technical concepts contained herein are also   
// proprietary to agersoftware srl and its suppliers or technological  
// partner NetLUP Xtreme Technologies srl and are protected by trade   
// secret or copyright law.                                            
//                                                                     
// CONFIDENTIAL                                                        
// Dissemination of this information or reproduction of this material  
// is strictly forbidden unless prior written permission is obtained   
// from agersoftware srl or NetLUP Xtreme Technologies srl.            
//                                                                     
// COPYRIGHT                                                           
// This software is provided by the copyright holders and technology   
// partners "as is" and any express or implied warranties, including,
// but not limited to, the implied warranties of merchantability and   
// fitness for a particular purpose are disclaimed.                    
//                                                                     
// NO LIABILITY                                                        
// In no event shall the copyright owner or technology partners be     
// liable for any direct, indirect, incidental, special, exemplary, or 
// consequential damages(including, but not limited to, procurement    
// of  substitute goods or services; loss of use, data, or profits;    
// or business interruption) however caused and on any theory of       
// liability, whether in contract, strict liability, or tort           
// (including negligence or otherwise)  arising in any way out of the  
// use of this software, even if advised of the possibility of such    
// damage.                                                             
//                                                                     
// INFO & CONTACT                                                  
// securesdk@securedelta.eu | securesdkinfo@agersoftware.com           
//                                                                     
///////////////////////////////////////////////////////////////////////

//
// SecureDELTA SDK :: SecureDECODE SDK Header File
//
// :: INTERNAL ::
// 
// agersoftware srl CONFIDENTIAL
// Copyright 2019-2029 agersoftware srl, All Rights Reserved.
//
// NOTICE: 
//
// All information contained herein is, and remains the property of
// agersoftware srl and etLUP Xtreme Technologies srl. The intellectual 
// and technical concepts contained herein are proprietary to agersoftware srl
// and NetLUP Xtreme Technologies srl and are protected 
// by trade secret, european and US copyright law(s). 
//
// Dissemination of this information or reproduction of this material is strictly forbidden 
// unless prior written permission is obtained from
// agersoftware srl.
//
//

#include <stdint.h>

#ifdef  SECUREDECODESDK_EXPORTS
#define SECURE_DECODE_SDK_API  extern "C" __declspec(dllexport)
#else
#define SECURE_DECODE_SDK_API extern "C" __declspec(dllimport)
#endif

#define _SD_SDK_MAX_VER_ 32// 32
#define _SD_SDK_MAXPATH_ 280// 280

#define SECURE_DECODE_PRIORITY_CLASS_RT       0x0 // REALTIME_PRIORITY_CLASS
#define SECURE_DECODE_PRIORITY_CLASS_HIGH     0x1 // HIGH_PRIORITY_CLASS 
#define SECURE_DECODE_PRIORITY_CLASS_ABOVE    0x2 // ABOVE_NORMAL_PRIORITY_CLASS 
#define SECURE_DECODE_PRIORITY_CLASS_NORMAL   0x3 // NORMAL_PRIORITY_CLASS
#define SECURE_DECODE_PRIORITY_CLASS_BELOW    0x4 // BELOW_NORMAL_PRIORITY_CLASS

#define SECURE_DECODE_SDK_DLL_NAME_x86								L"SecureDECODE_SDK_DLL_x86.dll"
#define SECURE_DECODE_SDK_DLL_NAME_x64								L"SecureDECODE_SDK_DLL_x64.dll"

#define SecureDELTA_SDK_DLL_SecureDECODE_Main_Func_					"SecureDELTA_SDK_SecureDECODE_Main_"
#define SecureDELTA_SDK_DLL_SecureDECODE_GetMessage_fromID_Func_	"SecureDELTA_SDK_SecureDECODE_GetMessageString_fromID_"

typedef enum  SD_SDK_SECURE_DECODE_RETURN_TYPEs
{
	SD_SDK_DECODE_NO_ERROR_ = 0x00,
	SD_SDK_DECODE_ERROR_INITIALIZATION_ = -1,
	SD_SDK_DECODE_ERROR_USER_CANCELED_ = -2,
	SD_SDK_DECODE_ERROR_NO_CALLBACK_PTR_ = -3,
	SD_SDK_DECODE_ERROR_NOT_USING_CALLBACK_PTR_ = -4,
	SD_SDK_DECODE_ERROR_GENERAL_ERROR_ = -5,
	SD_SDK_DECODE_HEADER_ERROR_ = -6,
	SD_SDK_DECODE_NEWER_VERSION_NEEDED_ = -7
}
SD_SDK_SECURE_DECODE_RETURN_ID;

typedef enum  SD_SDK_SECUREDECODE_STATUS_TYPE
{
	SD_SDK_DECODE_MASTER_OPERATION_SUCCESSFULL = 0x00,
	SD_SDK_DECODE_MASTER_OPERATION_CANCELLED_BY_USER = 0x04,
	SD_SDK_DECODE_MASTER_PERCENTAGE_AT_START_UP = 0x05,
	SD_SDK_DECODE_MASTER_PERCENTAGE_AT_READ_HEADER = 0x10,
	SD_SDK_DECODE_MASTER_PERCENTAGE_AT_LOAD_DICT = 0x15,
	SD_SDK_DECODE_MASTER_PERCENTAGE_AT_COMPUTE_CRC = 0x20,
	SD_SDK_DECODE_MASTER_PERCENTAGE_AT_READ_DICT_IN_MEM = 0x25,
	SD_SDK_DECODE_MASTER_PERCENTAGE_AT_COMPUTE_NEW_FILE = 0x30,
	SD_SDK_DECODE_MASTER_PERCENTAGE_AT_FINALIZING = 0x45,
	SD_SDK_DECODE_MASTER_PERCENTAGE_AT_CLOSE_FILES = 0x50,
	SD_SDK_DECODE_MASTER_PERCENTAGE_AT_END = 0x64
}
SD_SDK_SECURE_DECODE_STATUS_ID;

typedef enum 
{
	SD_SDK_DECODE_ENGINE_ERROR_MEMORY_INIT_NONE_ = 0x0000,
	SD_SDK_DECODE_ENGINE_ERROR_OPERATION_CANCELED_ = 0x0004,

	SD_SDK_DECODE_XTREME_ENGINE_ERROR_MEMORY_INIT_NONE_ = 0x0010,
	SD_SDK_DECODE_XTREME_ENGINE_ERROR_OPERATION_CANCELED_ = 0x0014,

	// File Errors
	SD_SDK_DECODE_ENGINE_INVALID_FILE_SIZE = 0xE000,
	SD_SDK_DECODE_ENGINE_COULD_NOT_OPEN_FILE = 0xE001,

	SD_SDK_DECODE_XTREME_ENGINE_INVALID_FILE_SIZE = 0xE010,
	SD_SDK_DECODE_XTREME_ENGINE_COULD_NOT_OPEN_FILE = 0xE011,
		
	// Signature Verification 
	SD_SDL_DECODE_DIGITAL_SIGNATURE_VERIFICATION_STARTED	 = 0xE050,
	SD_SDL_DECODE_DIGITAL_SIGNATURE_VERIFYING				 = 0xE051,
	SD_SDL_DECODE_DIGITAL_SIGNATURE_VERIFICATION_HAS_FAILED = 0xE052,
	SD_SDL_DECODE_DIGITAL_SIGNATURE_VERIFICATION_PASSED	 = 0xE053,

	// Dictionary Errors
	SD_SDK_DECODE_ENGINE_START_CRC_CHECK = 0xE100,
	SD_SDK_DECODE_XTREME_ENGINE_START_CRC_CHECK = 0xE120,

	// Dictionary Errors
	SD_SDK_DECODE_ENGINE_READ_HEADER = 0xE200,
	SD_SDK_DECODE_ENGINE_UPDAT_HEADER = 0xE200,

	SD_SDK_DECODE_XTREME_ENGINE_READ_HEADER = 0xE210,
	SD_SDK_DECODE_XTREME_ENGINE_UPDAT_HEADER = 0xE220,

	// Dictionary Errors
	SD_SDK_DECODE_ENGINE_START_LOAD_DICT = 0xE300,
	SD_SDK_DECODE_ENGINE_LOAD_DICT_PERCENT = 0xE301,
	SD_SDK_DECODE_ENGINE_STARTED_DONE_LOAD_DICT_NO_ERROR = 0xE302,
	SD_SDK_DECODE_ENGINE_STARTED_DONE_LOAD_DICT_ERROR_NOT_ENOUGH_MEM = 0xE303,

	SD_SDK_DECODE_XTREME_ENGINE_START_LOAD_DICT = 0xE400,
	SD_SDK_DECODE_XTREME_ENGINE_LOAD_DICT_PERCENT = 0xE401,
	SD_SDK_DECODE_XTREME_ENGINE_STARTED_DONE_LOAD_DICT_NO_ERROR = 0xE402,
	SD_SDK_DECODE_XTREME_ENGINE_STARTED_DONE_LOAD_DICT_ERROR_NOT_ENOUGH_MEM = 0xE403,

	// Performing SecureDECODE using SecureDELTA algorithm
	SD_SDK_DECODE_ENGINE_START_DELTA = 0xD400,
	SD_SDK_DECODE_ENGINE_DELTA_PERCENT = 0xD401,
	SD_SDK_DECODE_ENGINE_DELTA_CRC_CALCULATION = 0xD403,
	SD_SDK_DECODE_ENGINE_DELTA_CLOSING_ARCHIVE = 0xD404,
	SD_SDK_DECODE_ENGINE_DELTA_FINALIZING = 0xD402,
	SD_SDK_DECODE_ENGINE_DELTA_AT_END = 0xD405,
	SD_SDK_DECODE_ENGINE_DELTA_NO_ERROR = 0xD406,
	SD_SDK_DECODE_ENGINE_DELTA_ERROR = 0xD407,

	// Performing SecureDECODE using XtremeDELTA algorithm
	SD_SDK_DECODE_XTREME_ENGINE_START_DELTA = 0xD500,
	SD_SDK_DECODE_XTREME_ENGINE_DELTA_PERCENT = 0xD501,
	SD_SDK_DECODE_XTREME_ENGINE_DELTA_CRC_CALCULATION = 0xD503,
	SD_SDK_DECODE_XTREME_ENGINE_DELTA_CLOSING_ARCHIVE = 0xD504,
	SD_SDK_DECODE_XTREME_ENGINE_DELTA_FINALIZING = 0xD502,
	SD_SDK_DECODE_XTREME_ENGINE_DELTA_AT_END = 0xD505,
	SD_SDK_DECODE_XTREME_ENGINE_DELTA_NO_ERROR = 0xD506,
	SD_SDK_DECODE_XTREME_ENGINE_DELTA_ERROR = 0xD507
}
SD_SDK_SECURE_DECODE_EVENT_ID;

#pragma pack(push, 8)
typedef struct _CB_SD_SECURE_DECODE_EVENT_TYPE
{
	SD_SDK_SECURE_DECODE_EVENT_ID even_param_ID;
	uint32_t event_param_type;
	double   dbl_operation_progress_indicator;
	uint32_t uint_main_progress_indicator;
}
_SD_SDK_SECURE_DECODE_CALLBACK_EVENT, *P__SD_SDK_SECURE_DECODE_CALLBACK_EVENT;
#pragma pack(pop)

typedef const SD_SDK_SECURE_DECODE_RETURN_ID (__stdcall *pf_secure_decode_sdk_event_cb)(_SD_SDK_SECURE_DECODE_CALLBACK_EVENT _cb_sdk_event, void *p_sd_sdk_user_data, HWND _caller_HWND);

#pragma pack(push, 8)
typedef struct SD_SDK_SECURE_DECODE_PARAM
{
	uint8_t	 _use_callback;
	uint8_t  _cpu_priority_level;
	uint8_t  _reserved1;
	uint8_t  _reserved2;	// allows for forward compatibility with improved functionality
	uint32_t _reserved3;		   

	wchar_t  _wchr_sourcefile_path [_SD_SDK_MAXPATH_];
	wchar_t  _wchr_targetfile_path [_SD_SDK_MAXPATH_];
	wchar_t  _wchr_securedelta_path[_SD_SDK_MAXPATH_];

	wchar_t  _wchr_publickey_path  [_SD_SDK_MAXPATH_]; // The folder where the public key must exists

	void*	 _callback_p_user_data;
	HWND	 _callback_user_hwnd;
	pf_secure_decode_sdk_event_cb _sd_sdk_secure_callback_function;

	//set default params
	SD_SDK_SECURE_DECODE_PARAM()
	{
		_use_callback = 0x00;
		_cpu_priority_level = 0x00; // normal prio

        _sd_sdk_secure_callback_function = 0x00;
		_callback_p_user_data = 0x00;
		_callback_user_hwnd = 0x00;

		memset(_wchr_sourcefile_path, 0, sizeof(_wchr_sourcefile_path));
		memset(_wchr_targetfile_path, 0, sizeof(_wchr_targetfile_path));
		memset(_wchr_securedelta_path, 0, sizeof(_wchr_securedelta_path));
		memset(_wchr_publickey_path, 0, sizeof(_wchr_publickey_path));
	};
}
SD_SDK_SECURE_DECODE_PARAMS, *P_SD_SDK_SECURE_DECODE_PARAMS;
#pragma pack(pop)

/**
 *
 * Definitions of SecureDECODE function prototype
 *
 * @param _encode_param_struct The SD_SDK_SECURE_DECODE_PARAMS structure which contains all data required to perform the SecureDECODE operation
 *
 */

typedef int32_t (__stdcall *PF_SECUREDELTA_SDK_SECUREDECODE_MAIN)(SD_SDK_SECURE_DECODE_PARAMS& _encode_param_struct);
typedef const wchar_t * (__stdcall *PF_SECUREDELTA_SDK_SECUREDECODE_DLL_GETMESSAGESTRING_FROM_ID_)(const SD_SDK_SECURE_DECODE_EVENT_ID _string_enum_ID);

/**
 *
 * Call this function to perform the SecureDECODE operation that creates a SecureDELTA binary diff file
 * from source (initial / old file) and target (destination / new file)
 * You may set other options in SD_SDK_SECURE_DECODE_PARAMS
 *
 * @param _encode_param_struct The SD_SDK_SECURE_DECODE_PARAMS structure which contains all data required to perform the SecureDECODE operation
 *
 */

SECURE_DECODE_SDK_API int32_t __stdcall SecureDELTA_SDK_SecureDECODE_Main_(SD_SDK_SECURE_DECODE_PARAMS& _encode_param_struct);

/**
 *
 * Call this function to extract an internally defined string from a certain _string_enum_ID
 *
 * @param _string_enum_ID The string ID required to extract that particular string associated with the ID
 *
 * @return const wchar_t* The return is constant wide array pointer
 *
 */
SECURE_DECODE_SDK_API const wchar_t* __stdcall SecureDELTA_SDK_SecureDECODE_GetMessageString_fromID_(const SD_SDK_SECURE_DECODE_EVENT_ID _string_enum_ID);