The function returns the following error codes:
0 .... everything OK -1 ... the size of the Data array is less than 2