Well, in MSDN is stated that If you specify MAX_PREFERRED_LENGTH, the function allocates the amount of memory required for the data. Still returns ERROR_MORE_DATA?