The current patch fixes three main issues in AddSoundProfile():
- Don't return TRUE when CB_SETITEMDATA fails.
- Avoid pScheme NULL dereference if allocation fails. CID 1223154
- Avoid overflowing the destiny buffer by using StringCchCopy() CID 510953
As a bonus:
1) Make it more readable by returning as soon as possible when an error happens.
2) Make it more readable by reducing the nested ifs-checks.
3) Add a check to see if CB_SETITEMDATA fails.