There is error in RegSetValueEx call:
the 5th arg must be pointer, but we got DWORD which interpet like pointer
just add &
Nice one :)
If you give me your SF username, I'll add you up as a writer to the repository so that you can change these kind of bugs yourself...