What you're doing is not safe. Any time the default UI calls your replacement functions the execution path becomes tainted afterwards. If the call to PlaySound is eventually followed by some protected function call from signed code down the path, then it's going to break.
In cases where you want to replace an API function, you need to make sure that the function isn't used in any execution path that ultimately does something protected.
__________________
|