Basically, the problem is with a missing system device called Plug and Play Software Device Enumerator that normally can be seen in Device Manager under the System Devices category. If this device has driver problems, or goes missing for some reason then there'll be no sound in Windows and even the Sound applet in Control Panel shows "no audio device" detected. To resolve this, just reinstall the device.
:\> copy %windir%\inf\machine.inf %windir%\temp\machine.inf
:\> notepad %windir%\temp\machine.inf
|Editing machine.inf with Notepad|
Note: %windir% is a system variable that normally translates to C:\Windows. It always points to your Windows installation location by default.
Then, head over to Add Hardware in Control Panel and manually add the device back into Windows. It will search for new devices for a while before asking you if the hardware has already been added after it fails to find any new hardware. Just say "yes" to that.
|Add hardware wizard|
|Manually adding hardware|
You'll have to click on the "Have Disk..." button and point the wizard to the modified .inf file (%windir%\temp\machine.inf). Choose "Plug and Play Software Device Enumerator" under the Standard System Devices category.
|Adding Plug and Play Software Device Enumerator|
Once installation completes, you'll have sound working again on Windows.
No sound on Windows XP