aimdharma wrote:
LPTSTR aBuffer = NULL;
//...
aBuffer = (char *)malloc(sizeof(char)*aSize);
You should use types
consistently: namely a
LPTSTR
is a pointer to
TCHAR
, hence:
LPTSTR aBuffer = NULL;
aBuffer = (TCHAR *) malloc(sizeof(TCHAR) * aSize);
[update]
As correctly noted by
nv3, you need a buffer of exactly
aSize
bytes in order to call
RegQueryValueEx
, hence the correct allocation is:
aBuffer = (TCHAR *) malloc(aSize);
[/update]