Using:

FormatMessage(Format_Message_Allocate_Buffer + Format_Message_From_System, nil, dwResult, 0, @pstrError, 0, nil);

Taken from here.