Possible Fix for DWM.EXE error?

During shutdown on Vista, I would occasionally get the following error:
GDI+ Window: dwm.exe - Application Error : The instruction at 0x748573f6 referenced memory at 0x748573f6. The memory could not be written.


I was also having problems with a blank taskbar and notification area upon resume from sleep mode.

I believe that this could be related to changing the driver for nVidia graphics or changing disk access to AHCI causing the Desktop Window Manager to no longer be seen as genuine.

Here are the commands that (I hope) has fixed the issue:
cd %windir%\system32
wscript slmgr.vbs -rearm


Then, reboot when prompted.

UPDATE (29 July 2008): That wasn't enough. Try the following if you're still having trouble:
  1. Reinstall the license files with wscript slmgr.vbs -rilc (wait for confirmation)
  2. Reboot
  3. Go to Genuine Microsoft Software and click Validate Windows